Add wsl "machine"

This commit is contained in:
nathan mccarty 2022-07-06 01:42:31 -04:00
parent cc139355c3
commit 18913693e8
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
7 changed files with 259 additions and 1 deletions

View File

@ -190,6 +190,22 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1656065134,
@ -220,6 +236,21 @@
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"format-all": {
"flake": false,
"locked": {
@ -390,6 +421,42 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1655901362,
"narHash": "sha256-1cPiO869Dr3hqn1qhqd6amvw5U0PB7XDSdwMsIMWNiQ=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "898edde476232843da50c9a855efaf5dd8caadaa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1656753965,
@ -634,11 +701,13 @@
"java": "java",
"mozilla": "mozilla",
"nix-doom-emacs": "nix-doom-emacs",
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"polymc": "polymc",
"quilt-server": "quilt-server",
"sops-nix": "sops-nix"
"sops-nix": "sops-nix",
"wsl": "wsl"
}
},
"rotate-text": {
@ -740,6 +809,28 @@
"repo": "flake-utils",
"type": "github"
}
},
"wsl": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1656703122,
"narHash": "sha256-2Eb5dd7AYlJ359QmRomzlaQQLMep0kT0iVVfMMHE7SQ=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "46bf5e0f86b01faad3498bc4ef3706e5568b4fd6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
}
},
"root": "root",

View File

@ -45,6 +45,14 @@
url = "github:forward-progress/quilt-server-nix-container";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
@ -61,6 +69,8 @@
, nix-doom-emacs
, java
, quilt-server
, nixos-generators
, wsl
}@inputs:
let
makeNixosSystem = { system, hostName, extraModules ? [ ], ourNixpkgs ? nixpkgs }: ourNixpkgs.lib.nixosSystem {
@ -101,6 +111,7 @@
};
in
rec {
# Real systems
nixosConfigurations = {
levitation = makeNixosSystem {
system = "x86_64-linux";
@ -120,6 +131,28 @@
./machines/x86vm/configuration.nix
];
};
# WSL sytem
wsl = makeNixosSystem {
system = "x86_64-linux";
hostName = "wsl";
extraModules = [
wsl.nixosModules.wsl
./machines/wsl/configuration.nix
];
};
};
packages = {
x86_64-linux = {
# Hyper-V image
hyperv = nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [
./machines/hyperv/configuration.nix
];
format = "hyperv";
};
};
};
};
}

View File

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
{
# Setup system configuration
nathan = {
config = {
isDesktop = true;
setupGrub = true;
nix.autoUpdate = false;
harden = false;
};
};
# Configure networking
networking = {
domain = "mccarty.io";
useDHCP = false;
interfaces.enp6s0.useDHCP = true;
nat.externalInterface = "enp6s0";
# Open ports for soulseek
firewall = {
allowedTCPPorts = [ 61377 ];
allowedUDPPorts = [ 61377 ];
};
};
# Setup home manager
home-manager.users.nathan = import ./home.nix;
}

46
machines/hyperv/home.nix Normal file
View File

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
{
nathan = {
services = {
email = {
enable = true;
};
};
config = {
isDesktop = true;
};
};
# # Sway outputs
# wayland.windowManager.sway.config = {
# output = {
# DP-1 = {
# pos = "0 140";
# scale = "1";
# subpixel = "rgb";
# };
# DP-3 = {
# pos = "2560 0";
# scale = "1.25";
# subpixel = "rgb";
# };
# HDMI-A-1 = {
# pos = "5632 140";
# scale = "1";
# subpixel = "rgb";
# };
# };
# startup = [
# # GLPaper
# { command = "glpaper DP-1 ${../../custom-files/sway/selen.frag} --fork"; }
# { command = "glpaper DP-3 ${../../custom-files/sway/selen.frag} --fork"; }
# { command = "glpaper HDMI-A-1 ${../../custom-files/sway/selen.frag} --fork"; }
# ];
# };
# # Mako output configuration
# programs.mako = {
# # Lock mako notifs to main display
# output = "DP-3";
# };
}

View File

@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
{
# Setup system configuration
nathan = {
services = {
ssh = false;
tailscale.enable = false;
};
config = {
installUser = false;
nix.autoUpdate = false;
harden = false;
fonts = true;
};
};
# Configure networking
networking = {
domain = "mccarty.io";
};
# Setup home manager
home-manager.users.nathan = import ./home.nix;
}

30
machines/wsl/home.nix Normal file
View File

@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
{
nathan = {
services = {
email = {
# TODO: enable
enable = false;
};
};
programs = {
util = {
productivity = true;
};
devel = {
core = true;
rust = true;
jvm = true;
python = true;
js = true;
raku = true;
};
emacs = {
enable = true;
# TODO: enable
service = false;
};
};
};
}

View File

@ -184,5 +184,11 @@ in
];
# Set system state version
system.stateVersion = "22.05";
# Enable flakes
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
};
}