Compare commits
4 Commits
3bd412ef0e
...
0e8ec4cd07
Author | SHA1 | Date | |
---|---|---|---|
0e8ec4cd07 | |||
0c22543f87 | |||
03c2cf5ee7 | |||
1eea1ceaba |
82
flake.lock
generated
82
flake.lock
generated
@ -1,5 +1,36 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"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": 1653893745,
|
||||||
|
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@ -7,43 +38,65 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651519540,
|
"lastModified": 1654113405,
|
||||||
"narHash": "sha256-3k6p8VsTwwRPQjE8rrMh+o2AZACZn/eeYJ7ivdQ/Iro=",
|
"narHash": "sha256-VpK+0QaWG2JRgB00lw77N9TjkE3ec0iMYIX1TzGpxa4=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "d93d56ab8c1c6aa575854a79b9d2f69d491db7d0",
|
"rev": "ac2287df5a2d6f0a44bbcbd11701dbbf6ec43675",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"ref": "release-21.11",
|
"ref": "release-22.05",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixos-wsl": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1654591300,
|
||||||
|
"narHash": "sha256-53a6fimkMTc1DqnzdEWFHbaOT1xlMgeOJaD2/IGO22k=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "NixOS-WSL",
|
||||||
|
"rev": "4de4d6acb7fc868677380496b62a5e51890fc331",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "NixOS-WSL",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651848520,
|
"lastModified": 1654442937,
|
||||||
"narHash": "sha256-KkJ28fShdd78+zal5HlHsXUICOCtO7Bdvylc5zlp5Mk=",
|
"narHash": "sha256-dYJ79gt85hwIbPlX52eAwnkYzMexLyNRmRcTRpMn+Gw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5656d7f92aa8264eb06ba68ad94c87ac5b5312e8",
|
"rev": "ca2629644d4a5098004e20cb9ca179345f2acd8e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-21.11",
|
"ref": "nixos-22.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651887110,
|
"lastModified": 1654593979,
|
||||||
"narHash": "sha256-AMQ0A5Osq647zEHWb+GZEIYZeNrZm55kY24uVOqSTzg=",
|
"narHash": "sha256-iDvyU5vs7IoPBpxwhNAI/J3llDsmtzH1xYqvCGvzCww=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "c7a43bc69e52a636e76ba3d378695c1bd4f0bbbd",
|
"rev": "47044837d4ebcaa37e699d92d893a32d4e301852",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -55,6 +108,7 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"nixos-wsl": "nixos-wsl",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"unstable": "unstable"
|
"unstable": "unstable"
|
||||||
@ -62,11 +116,11 @@
|
|||||||
},
|
},
|
||||||
"unstable": {
|
"unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651726670,
|
"lastModified": 1654230545,
|
||||||
"narHash": "sha256-dSGdzB49SEvdOJvrQWfQYkAefewXraHIV08Vz6iDXWQ=",
|
"narHash": "sha256-8Vlwf0x8ow6pPOK2a04bT+pxIeRnM1+O0Xv9/CuDzRs=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c777cdf5c564015d5f63b09cc93bef4178b19b01",
|
"rev": "236cc2971ac72acd90f0ae3a797f9f83098b17ec",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
13
flake.nix
13
flake.nix
@ -2,19 +2,26 @@
|
|||||||
description = "Michael Thomas's NixOS configuration";
|
description = "Michael Thomas's NixOS configuration";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||||
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nur.url = "github:nix-community/NUR";
|
nur.url = "github:nix-community/NUR";
|
||||||
|
|
||||||
|
nixos-wsl = {
|
||||||
|
url = "github:nix-community/NixOS-WSL";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:rycee/home-manager/release-21.11";
|
url = "github:rycee/home-manager/release-22.05";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, unstable, nur, home-manager, ... }@inputs: {
|
outputs = { self, nixpkgs, unstable, nur, nixos-wsl, home-manager, ... }@inputs: {
|
||||||
|
|
||||||
# This repo's overlay plus any other overlays you use
|
# This repo's overlay plus any other overlays you use
|
||||||
# If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.
|
# If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
{ lib, pkgs, config, modulesPath, ... }:
|
{ lib, pkgs, config, modulesPath, inputs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
defaultUser = "michael";
|
defaultUser = "michael";
|
||||||
syschdemd = import ./syschdemd.nix { inherit lib pkgs config defaultUser; };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
"${modulesPath}/profiles/minimal.nix"
|
"${modulesPath}/profiles/minimal.nix"
|
||||||
|
|
||||||
|
inputs.nixos-wsl.nixosModules.wsl
|
||||||
];
|
];
|
||||||
|
|
||||||
# WSL is closer to a container than anything else
|
wsl = {
|
||||||
boot.isContainer = true;
|
enable = true;
|
||||||
|
automountPath = "/mnt";
|
||||||
|
defaultUser = defaultUser;
|
||||||
|
startMenuLaunchers = true;
|
||||||
|
|
||||||
environment.etc.hosts.enable = false;
|
# Enable integration with Docker Desktop (needs to be installed)
|
||||||
environment.etc."resolv.conf".enable = false;
|
# docker.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
|
|
||||||
programs.adb.enable = true;
|
programs.adb.enable = true;
|
||||||
networking.dhcpcd.enable = false;
|
|
||||||
|
|
||||||
# Required because for some reason WSL kernel doesn't play well with nftables
|
# Required because for some reason WSL kernel doesn't play well with nftables
|
||||||
networking.firewall.package = pkgs.iptables-legacy;
|
networking.firewall.package = pkgs.iptables-legacy;
|
||||||
@ -40,29 +44,10 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
users.users.${defaultUser} = {
|
users.users.${defaultUser} = {
|
||||||
isNormalUser = true;
|
uid = pkgs.lib.mkForce 1001;
|
||||||
extraGroups = [ "wheel" "docker" "podman" ];
|
extraGroups = [ "wheel" "docker" "podman" ];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.root = {
|
system.stateVersion = "21.11";
|
||||||
shell = "${syschdemd}/bin/syschdemd";
|
|
||||||
# Otherwise WSL fails to login as root with "initgroups failed 5"
|
|
||||||
extraGroups = [ "root" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
security.sudo.wheelNeedsPassword = false;
|
|
||||||
|
|
||||||
# Disable systemd units that don't make sense on WSL
|
|
||||||
systemd.services."serial-getty@ttyS0".enable = false;
|
|
||||||
systemd.services."serial-getty@hvc0".enable = false;
|
|
||||||
systemd.services."getty@tty1".enable = false;
|
|
||||||
systemd.services."autovt@".enable = false;
|
|
||||||
|
|
||||||
systemd.services.firewall.enable = false;
|
|
||||||
systemd.services.systemd-resolved.enable = false;
|
|
||||||
systemd.services.systemd-udevd.enable = false;
|
|
||||||
|
|
||||||
# Don't allow emergency mode, because we don't have a console.
|
|
||||||
systemd.enableEmergencyMode = false;
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
{ lib, pkgs, config, defaultUser, ... }:
|
|
||||||
|
|
||||||
pkgs.substituteAll {
|
|
||||||
name = "syschdemd";
|
|
||||||
src = ./syschdemd.sh;
|
|
||||||
dir = "bin";
|
|
||||||
isExecutable = true;
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [ daemonize ];
|
|
||||||
|
|
||||||
inherit (pkgs) daemonize;
|
|
||||||
inherit defaultUser;
|
|
||||||
inherit (config.security) wrapperDir;
|
|
||||||
fsPackagesPath = lib.makeBinPath config.system.fsPackages;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#! @shell@
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sw="/nix/var/nix/profiles/system/sw/bin"
|
|
||||||
systemPath=`${sw}/readlink -f /nix/var/nix/profiles/system`
|
|
||||||
|
|
||||||
# Needs root to work
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
echo "[ERROR] Requires root! :( Make sure the WSL default user is set to root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "/run/current-system" ]; then
|
|
||||||
/nix/var/nix/profiles/system/activate
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "/run/systemd.pid" ]; then
|
|
||||||
PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
|
|
||||||
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \
|
|
||||||
@daemonize@/bin/daemonize /run/current-system/sw/bin/unshare -fp --mount-proc systemd
|
|
||||||
/run/current-system/sw/bin/pgrep -xf systemd > /run/systemd.pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
userShell=$($sw/getent passwd @defaultUser@ | $sw/cut -d: -f7)
|
|
||||||
exec $sw/nsenter -t $(< /run/systemd.pid) -p -m --wd="$PWD" -- @wrapperDir@/su -s $userShell @defaultUser@ "$@"
|
|
@ -2,10 +2,10 @@
|
|||||||
{
|
{
|
||||||
nix = {
|
nix = {
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
experimental-features = flakes nix-command
|
experimental-features = flakes nix-command
|
||||||
'';
|
'';
|
||||||
# this is required until nix 2.4 is released
|
# this is required until nix 2.4 is released
|
||||||
package = pkgs.nixUnstable;
|
package = pkgs.nixFlakes;
|
||||||
|
|
||||||
autoOptimiseStore = true;
|
autoOptimiseStore = true;
|
||||||
gc = {
|
gc = {
|
||||||
|
@ -9,5 +9,9 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
userEmail = "michaelhthomas@outlook.com";
|
userEmail = "michaelhthomas@outlook.com";
|
||||||
userName = "Michael Thomas";
|
userName = "Michael Thomas";
|
||||||
|
extraConfig = {
|
||||||
|
credential.helper = "store";
|
||||||
|
pull.rebase = "false";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user