From 29fd1186359fc147bb7578d66ed8634cd8bf432b Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 13 Jan 2025 14:53:42 -0500 Subject: [PATCH] Reformat --- devshells/idris2.nix | 71 ++++++------ devshells/raku.nix | 77 +++++++------ devshells/rust.nix | 31 +++--- flake.nix | 42 ++++---- home-manager/machines/crash/home.nix | 106 +++++++++--------- home-manager/machines/wsl/home.nix | 92 ++++++++-------- home-manager/modules/programs/core.nix | 10 +- home-manager/modules/programs/desktop.nix | 5 +- home-manager/modules/programs/devel.nix | 4 +- home-manager/modules/programs/emacs.nix | 33 +++--- home-manager/modules/programs/fonts.nix | 8 +- home-manager/modules/programs/git.nix | 7 +- home-manager/modules/programs/neovim.nix | 4 +- home-manager/modules/programs/shell.nix | 5 +- home-manager/modules/programs/ssh.nix | 4 +- nixos/machines/crash/configuration.nix | 12 +-- nixos/machines/crash/hardware.nix | 12 +-- nixos/machines/crash/machine.nix | 88 +++++++-------- nixos/machines/installer/configuration.nix | 102 +++++++++--------- nixos/machines/wsl/configuration.nix | 120 +++++++++++---------- nixos/modules/base.nix | 7 +- nixos/modules/user.nix | 8 +- 22 files changed, 424 insertions(+), 424 deletions(-) diff --git a/devshells/idris2.nix b/devshells/idris2.nix index 358cfea..0158575 100644 --- a/devshells/idris2.nix +++ b/devshells/idris2.nix @@ -1,38 +1,37 @@ -{ withSystem, inputs, ... }: { - perSystem = - { - config, - pkgs, - lib, - inputs', - ... - }: - { - devShells.idris2 = - let - libPackages = with pkgs; [ - readline70 - openssl - ]; - in - pkgs.mkShell { - buildInputs = - with pkgs; - [ - # Idris toolchain - inputs'.nixpkgs-unstable.legacyPackages.idris2Packages.pack - inputs'.nixpkgs-unstable.legacyPackages.idris2 - pkg-config - gmp - gnumake - chez - rlwrap - ] - ++ libPackages; - shellHook = '' - export LD_LIBRARY_PATH=${lib.makeLibraryPath libPackages} - ''; - }; - }; + withSystem, + inputs, + ... +}: { + perSystem = { + config, + pkgs, + lib, + inputs', + ... + }: { + devShells.idris2 = let + libPackages = with pkgs; [ + readline70 + openssl + ]; + in + pkgs.mkShell { + buildInputs = with pkgs; + [ + # Idris toolchain + inputs'.nixpkgs-unstable.legacyPackages.idris2Packages.pack + inputs'.nixpkgs-unstable.legacyPackages.idris2 + pkg-config + gmp + gnumake + chez + rlwrap + ] + ++ libPackages; + shellHook = '' + export LD_LIBRARY_PATH=${lib.makeLibraryPath libPackages} + ''; + }; + }; } diff --git a/devshells/raku.nix b/devshells/raku.nix index 0cce9d3..b7a6d7c 100644 --- a/devshells/raku.nix +++ b/devshells/raku.nix @@ -1,41 +1,40 @@ -{ withSystem, inputs, ... }: { - perSystem = - { - config, - pkgs, - lib, - inputs', - ... - }: - { - devShells.raku = - let - rakudo_env = pkgs.buildEnv { - name = "rakudo-env"; - paths = with pkgs; [ - rakudo - zef - ]; - pathsToLink = [ - "/bin" - "/lib" - "/share" - ]; - }; - libPackages = with pkgs; [ readline70 ]; - in - pkgs.mkShell { - buildInputs = - with pkgs; - [ - # Raku toolchain - rakudo_env - ] - ++ libPackages; - shellHook = '' - export LD_LIBRARY_PATH=${lib.makeLibraryPath libPackages} - ''; - }; - }; + withSystem, + inputs, + ... +}: { + perSystem = { + config, + pkgs, + lib, + inputs', + ... + }: { + devShells.raku = let + rakudo_env = pkgs.buildEnv { + name = "rakudo-env"; + paths = with pkgs; [ + rakudo + zef + ]; + pathsToLink = [ + "/bin" + "/lib" + "/share" + ]; + }; + libPackages = with pkgs; [readline70]; + in + pkgs.mkShell { + buildInputs = with pkgs; + [ + # Raku toolchain + rakudo_env + ] + ++ libPackages; + shellHook = '' + export LD_LIBRARY_PATH=${lib.makeLibraryPath libPackages} + ''; + }; + }; } diff --git a/devshells/rust.nix b/devshells/rust.nix index 5207e18..6c9371c 100644 --- a/devshells/rust.nix +++ b/devshells/rust.nix @@ -1,16 +1,21 @@ -{ withSystem, inputs, ... }: { - perSystem = - { config, pkgs, ... }: - { - devShells.rust = pkgs.mkShell { - buildInputs = with pkgs; [ - # Rust toolchain - clang - rustup - # Faster builds - sccache - ]; - }; + withSystem, + inputs, + ... +}: { + perSystem = { + config, + pkgs, + ... + }: { + devShells.rust = pkgs.mkShell { + buildInputs = with pkgs; [ + # Rust toolchain + clang + rustup + # Faster builds + sccache + ]; }; + }; } diff --git a/flake.nix b/flake.nix index d40d6bf..6498f74 100644 --- a/flake.nix +++ b/flake.nix @@ -20,9 +20,12 @@ }; }; - outputs = - inputs@{ flake-parts, self, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { + outputs = inputs @ { + flake-parts, + self, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { imports = [ inputs.devshell.flakeModule ./nixos/machines/wsl/configuration.nix @@ -41,31 +44,28 @@ "aarch64-darwin" "x86_64-darwin" ]; - perSystem = - { - config, - self', - inputs', - pkgs, - system, - ... - }: - { - # Per-system attributes can be defined here. The self' and inputs' - # module parameters provide easy access to attributes of the same - # system. + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: { + # Per-system attributes can be defined here. The self' and inputs' + # module parameters provide easy access to attributes of the same + # system. - # Equivalent to inputs'.nixpkgs.legacyPackages.hello; - packages.default = pkgs.hello; - }; + # Equivalent to inputs'.nixpkgs.legacyPackages.hello; + packages.default = pkgs.hello; + }; }; options = with inputs.nixpkgs.lib; { flake = flake-parts.lib.mkSubmoduleOptions { homeConfigurations = mkOption { type = types.lazyAttrsOf types.raw; - default = { }; + default = {}; }; - }; }; }; diff --git a/home-manager/machines/crash/home.nix b/home-manager/machines/crash/home.nix index 153c8ce..a1a3b1d 100644 --- a/home-manager/machines/crash/home.nix +++ b/home-manager/machines/crash/home.nix @@ -1,61 +1,67 @@ -{ withSystem, inputs, ... }: { + withSystem, + inputs, + ... +}: { # perSystem = { ... }: { config.packages.hello = ...; }; flake.homeConfigurations.crash = withSystem "x86_64-linux" ( - ctx@{ config, inputs', ... }: - inputs.home-manager.lib.homeManagerConfiguration { - pkgs = inputs.nixpkgs.legacyPackages.${"x86_64-linux"}; - extraSpecialArgs = { - inherit inputs inputs'; - packages = config.packages; - }; - modules = [ - ( - { - config, - lib, - pkgs, - ... - }: - { - imports = [ - ../../modules/programs/shell.nix - ../../modules/programs/neovim.nix - (import ../../modules/programs/git.nix { }) - ../../modules/programs/core.nix - ../../modules/programs/devel.nix - ../../modules/programs/ssh.nix - (import ../../modules/programs/emacs.nix { }) - ../../modules/programs/fonts.nix - ../../modules/programs/desktop.nix - ]; - home.username = "nathan"; - home.homeDirectory = "/home/nathan/"; - programs.command-not-found.enable = true; - home.stateVersion = "24.11"; - programs.home-manager.enable = true; + ctx @ { + config, + inputs', + ... + }: + inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.${"x86_64-linux"}; + extraSpecialArgs = { + inherit inputs inputs'; + packages = config.packages; + }; + modules = [ + ( + { + config, + lib, + pkgs, + ... + }: { + imports = [ + ../../modules/programs/shell.nix + ../../modules/programs/neovim.nix + (import ../../modules/programs/git.nix {}) + ../../modules/programs/core.nix + ../../modules/programs/devel.nix + ../../modules/programs/ssh.nix + (import ../../modules/programs/emacs.nix {}) + ../../modules/programs/fonts.nix + ../../modules/programs/desktop.nix + ]; + home.username = "nathan"; + home.homeDirectory = "/home/nathan/"; + programs.command-not-found.enable = true; + home.stateVersion = "24.11"; + programs.home-manager.enable = true; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; - # Machine specific configuration - services.emacs.defaultEditor = true; + # Machine specific configuration + services.emacs.defaultEditor = true; - systemd.user = { - targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session.target" ]; + systemd.user = { + targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = ["graphical-session.target"]; + }; + }; + services.syncthingtray = { + Service.ExecStart = lib.mkForce "${pkgs.syncthingtray}/bin/syncthingtray --wait"; }; }; - services.syncthingtray = { - Service.ExecStart = lib.mkForce "${pkgs.syncthingtray}/bin/syncthingtray --wait"; - }; - }; - } - ) - ]; - } + } + ) + ]; + } ); } diff --git a/home-manager/machines/wsl/home.nix b/home-manager/machines/wsl/home.nix index 0c95f0c..600f974 100644 --- a/home-manager/machines/wsl/home.nix +++ b/home-manager/machines/wsl/home.nix @@ -1,51 +1,57 @@ -{ withSystem, inputs, ... }: { + withSystem, + inputs, + ... +}: { # perSystem = { ... }: { config.packages.hello = ...; }; flake.homeConfigurations.wsl = withSystem "x86_64-linux" ( - ctx@{ config, inputs', ... }: - inputs.home-manager.lib.homeManagerConfiguration { - pkgs = inputs.nixpkgs.legacyPackages.${"x86_64-linux"}; - extraSpecialArgs = { - inherit inputs inputs'; - packages = config.packages; - }; - modules = [ - ( - { - config, - lib, - pkgs, - ... - }: - { - imports = [ - ../../modules/programs/shell.nix - ../../modules/programs/neovim.nix - (import ../../modules/programs/git.nix { }) - ../../modules/programs/core.nix - ../../modules/programs/devel.nix - ../../modules/programs/ssh.nix - (import ../../modules/programs/emacs.nix { }) - ../../modules/programs/fonts.nix - ]; - home.username = "nathan"; - home.homeDirectory = "/home/nathan/"; - programs.command-not-found.enable = true; - home.stateVersion = "24.11"; - programs.home-manager.enable = true; + ctx @ { + config, + inputs', + ... + }: + inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.${"x86_64-linux"}; + extraSpecialArgs = { + inherit inputs inputs'; + packages = config.packages; + }; + modules = [ + ( + { + config, + lib, + pkgs, + ... + }: { + imports = [ + ../../modules/programs/shell.nix + ../../modules/programs/neovim.nix + (import ../../modules/programs/git.nix {}) + ../../modules/programs/core.nix + ../../modules/programs/devel.nix + ../../modules/programs/ssh.nix + (import ../../modules/programs/emacs.nix {}) + ../../modules/programs/fonts.nix + ]; + home.username = "nathan"; + home.homeDirectory = "/home/nathan/"; + programs.command-not-found.enable = true; + home.stateVersion = "24.11"; + programs.home-manager.enable = true; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; - # Machine specific configuration - programs.nushell.environmentVariables = { - VISUAL = "nvim"; - EDITOR = "nvim"; - }; - } - ) - ]; - } + # Machine specific configuration + programs.nushell.environmentVariables = { + VISUAL = "nvim"; + EDITOR = "nvim"; + }; + } + ) + ]; + } ); } diff --git a/home-manager/modules/programs/core.nix b/home-manager/modules/programs/core.nix index 8183776..c8088da 100644 --- a/home-manager/modules/programs/core.nix +++ b/home-manager/modules/programs/core.nix @@ -3,9 +3,7 @@ lib, pkgs, ... -}: - -{ +}: { home.packages = with pkgs; [ # Rust rewrites of cli stuff fd @@ -41,7 +39,10 @@ aggressiveResize = true; keyMode = "vi"; shortcut = "x"; - terminal = if pkgs.stdenv.isLinux then "tmux-256color" else "screen-256color"; + terminal = + if pkgs.stdenv.isLinux + then "tmux-256color" + else "screen-256color"; escapeTime = 100; plugins = with pkgs; [ tmuxPlugins.cpu @@ -56,5 +57,4 @@ }; programs.btop.enable = true; programs.jq.enable = true; - } diff --git a/home-manager/modules/programs/desktop.nix b/home-manager/modules/programs/desktop.nix index c0bcb7e..574cf03 100644 --- a/home-manager/modules/programs/desktop.nix +++ b/home-manager/modules/programs/desktop.nix @@ -4,9 +4,7 @@ pkgs, inputs', ... -}: - -{ +}: { home.packages = with pkgs; [ # Communications webcord-vencord @@ -27,5 +25,4 @@ enable = true; }; }; - } diff --git a/home-manager/modules/programs/devel.nix b/home-manager/modules/programs/devel.nix index 125958f..b126712 100644 --- a/home-manager/modules/programs/devel.nix +++ b/home-manager/modules/programs/devel.nix @@ -4,9 +4,7 @@ pkgs, inputs', ... -}: - -{ +}: { home.packages = with pkgs; [ # Git addons git-secret diff --git a/home-manager/modules/programs/emacs.nix b/home-manager/modules/programs/emacs.nix index 18301c8..2f5712b 100644 --- a/home-manager/modules/programs/emacs.nix +++ b/home-manager/modules/programs/emacs.nix @@ -1,21 +1,19 @@ -{ - emacsPackage ? null, -}: -{ +{emacsPackage ? null}: { config, lib, pkgs, ... -}: -let +}: let myAspell = pkgs.aspellWithDicts (d: [ d.en d.en-science d.en-computers ]); - emacsPackage' = if emacsPackage == null then pkgs.emacs29-pgtk else emacsPackage; -in -{ + emacsPackage' = + if emacsPackage == null + then pkgs.emacs29-pgtk + else emacsPackage; +in { home.packages = with pkgs; [ # For markdown rendering python312Packages.grip @@ -48,7 +46,7 @@ in comment = "Org protocol"; desktopName = "org-protocol"; type = "Application"; - mimeTypes = [ "x-scheme-handler/org-protocol" ]; + mimeTypes = ["x-scheme-handler/org-protocol"]; }) # For format output # wkhtmltopdf @@ -56,19 +54,20 @@ in programs.emacs = { enable = true; package = emacsPackage'; - extraPackages = - epkgs: with pkgs; [ + extraPackages = epkgs: + with pkgs; [ epkgs.mu4e epkgs.vterm epkgs.pdf-tools epkgs.emacsql epkgs.emacsql-sqlite (tree-sitter.withPlugins ( - grammars: with grammars; [ - tree-sitter-nix - tree-sitter-rust - tree-sitter-toml - ] + grammars: + with grammars; [ + tree-sitter-nix + tree-sitter-rust + tree-sitter-toml + ] )) ]; }; diff --git a/home-manager/modules/programs/fonts.nix b/home-manager/modules/programs/fonts.nix index a66f54c..ba52855 100644 --- a/home-manager/modules/programs/fonts.nix +++ b/home-manager/modules/programs/fonts.nix @@ -3,9 +3,7 @@ lib, pkgs, ... -}: - -{ +}: { fonts.fontconfig = { enable = true; defaultFonts = { @@ -13,8 +11,8 @@ "Noto Emoji" "Noto Color Emoji" ]; - monospace = [ "JetBrainsMono-NF-Regular" ]; - sansSerif = [ "Roboto" ]; + monospace = ["JetBrainsMono-NF-Regular"]; + sansSerif = ["Roboto"]; }; }; diff --git a/home-manager/modules/programs/git.nix b/home-manager/modules/programs/git.nix index 2874d85..2ba5052 100644 --- a/home-manager/modules/programs/git.nix +++ b/home-manager/modules/programs/git.nix @@ -1,15 +1,12 @@ { gitUserName ? "Nathan McCarty", gitUserEmail ? "thatonelutenist@stranger.systems", -}: -{ +}: { config, lib, pkgs, ... -}: - -{ +}: { programs.git = { enable = true; package = pkgs.gitAndTools.gitFull; diff --git a/home-manager/modules/programs/neovim.nix b/home-manager/modules/programs/neovim.nix index 7aa636c..2917f6e 100644 --- a/home-manager/modules/programs/neovim.nix +++ b/home-manager/modules/programs/neovim.nix @@ -3,9 +3,7 @@ lib, pkgs, ... -}: - -{ +}: { programs.neovim = { enable = true; viAlias = true; diff --git a/home-manager/modules/programs/shell.nix b/home-manager/modules/programs/shell.nix index b42461e..08e4538 100644 --- a/home-manager/modules/programs/shell.nix +++ b/home-manager/modules/programs/shell.nix @@ -3,9 +3,7 @@ lib, pkgs, ... -}: - -{ +}: { programs.nushell = { enable = true; configFile.source = ./nushell/config.nu; @@ -64,5 +62,4 @@ }; programs.fzf.enable = true; - } diff --git a/home-manager/modules/programs/ssh.nix b/home-manager/modules/programs/ssh.nix index 8211f7c..7568809 100644 --- a/home-manager/modules/programs/ssh.nix +++ b/home-manager/modules/programs/ssh.nix @@ -3,9 +3,7 @@ lib, pkgs, ... -}: - -{ +}: { programs.ssh = { # SSH configuration enable = true; diff --git a/nixos/machines/crash/configuration.nix b/nixos/machines/crash/configuration.nix index 9a1e6a5..301f0d5 100644 --- a/nixos/machines/crash/configuration.nix +++ b/nixos/machines/crash/configuration.nix @@ -1,10 +1,11 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, ... }: - { + config, + pkgs, + ... +}: { imports = [ ]; @@ -18,7 +19,7 @@ ''; programs.ssh.knownHosts = { nixbuild = { - hostNames = [ "eu.nixbuild.net" ]; + hostNames = ["eu.nixbuild.net"]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM"; }; }; @@ -144,7 +145,7 @@ # Define a user account. Don't forget to set a password with ‘passwd’. users.users.nathan = { - extraGroups = [ "networkmanager" ]; + extraGroups = ["networkmanager"]; }; # Install firefox. @@ -185,5 +186,4 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "24.11"; # Did you read the comment? - } diff --git a/nixos/machines/crash/hardware.nix b/nixos/machines/crash/hardware.nix index cca4031..9ee5a0d 100644 --- a/nixos/machines/crash/hardware.nix +++ b/nixos/machines/crash/hardware.nix @@ -7,9 +7,7 @@ pkgs, modulesPath, ... -}: - -{ +}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; @@ -20,9 +18,9 @@ "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/0a846b89-7219-47c1-9db5-362e3c018964"; @@ -39,7 +37,7 @@ }; swapDevices = [ - { device = "/dev/disk/by-uuid/bf35a46f-552c-4b37-a68b-c2fcf132f359"; } + {device = "/dev/disk/by-uuid/bf35a46f-552c-4b37-a68b-c2fcf132f359";} ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/nixos/machines/crash/machine.nix b/nixos/machines/crash/machine.nix index be21325..53690f9 100644 --- a/nixos/machines/crash/machine.nix +++ b/nixos/machines/crash/machine.nix @@ -1,49 +1,53 @@ -{ withSystem, inputs, ... }: { + withSystem, + inputs, + ... +}: { # perSystem = { ... }: { config.packages.hello = ...; }; flake.nixosConfigurations.crash = withSystem "x86_64-linux" ( - ctx@{ config, inputs', ... }: - inputs.nixpkgs.lib.nixosSystem { - # Expose `packages`, `inputs` and `inputs'` as module arguments. - # Use specialArgs permits use in `imports`. - # Note: if you publish modules for reuse, do not rely on specialArgs, but - # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html - specialArgs = { - packages = config.packages; - inherit inputs inputs'; - }; - modules = [ - ( - { - config, - lib, - pkgs, - ... - }: + ctx @ { + config, + inputs', + ... + }: + inputs.nixpkgs.lib.nixosSystem { + # Expose `packages`, `inputs` and `inputs'` as module arguments. + # Use specialArgs permits use in `imports`. + # Note: if you publish modules for reuse, do not rely on specialArgs, but + # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html + specialArgs = { + packages = config.packages; + inherit inputs inputs'; + }; + modules = [ + ( + { + config, + lib, + pkgs, + ... + }: { + imports = [ + # Hardware support + inputs.nixos-hardware.nixosModules.microsoft-surface-common + # Our modules + (import ../../modules/base.nix {inherit inputs;}) + (import ./configuration.nix) + (import ./hardware.nix) + (import ../../modules/user.nix { + inherit inputs; + mutableUsers = false; + }) + ]; - { - imports = [ - # Hardware support - inputs.nixos-hardware.nixosModules.microsoft-surface-common - # Our modules - (import ../../modules/base.nix { inherit inputs; }) - (import ./configuration.nix) - (import ./hardware.nix) - (import ../../modules/user.nix { - inherit inputs; - mutableUsers = false; - }) - ]; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - } - ) - ]; - } + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + } + ) + ]; + } ); } diff --git a/nixos/machines/installer/configuration.nix b/nixos/machines/installer/configuration.nix index 216e31d..e213f29 100644 --- a/nixos/machines/installer/configuration.nix +++ b/nixos/machines/installer/configuration.nix @@ -1,60 +1,64 @@ -{ withSystem, inputs, ... }: { + withSystem, + inputs, + ... +}: { # perSystem = { ... }: { config.packages.hello = ...; }; flake.nixosConfigurations.inst = withSystem "x86_64-linux" ( - ctx@{ config, inputs', ... }: - inputs.nixpkgs.lib.nixosSystem { - # Expose `packages`, `inputs` and `inputs'` as module arguments. - # Use specialArgs permits use in `imports`. - # Note: if you publish modules for reuse, do not rely on specialArgs, but - # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html - specialArgs = { - packages = config.packages; - inherit inputs inputs'; - }; - modules = [ - "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix" - "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" - inputs.nixos-hardware.nixosModules.microsoft-surface-common - ( - # NixOS-WSL specific options are documented on the NixOS-WSL repository: - # https://github.com/nix-community/NixOS-WSL + ctx @ { + config, + inputs', + ... + }: + inputs.nixpkgs.lib.nixosSystem { + # Expose `packages`, `inputs` and `inputs'` as module arguments. + # Use specialArgs permits use in `imports`. + # Note: if you publish modules for reuse, do not rely on specialArgs, but + # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html + specialArgs = { + packages = config.packages; + inherit inputs inputs'; + }; + modules = [ + "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma5.nix" + "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" + inputs.nixos-hardware.nixosModules.microsoft-surface-common + ( + # NixOS-WSL specific options are documented on the NixOS-WSL repository: + # https://github.com/nix-community/NixOS-WSL + { + config, + lib, + pkgs, + ... + }: { + imports = [ + ]; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - { - config, - lib, - pkgs, - ... - }: + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; - { - imports = [ - ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + networking.hostId = "9affdaa4"; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; + environment.systemPackages = with pkgs; [ + ]; - networking.hostId = "9affdaa4"; + time.timeZone = "America/Kentucky/Louisville"; - environment.systemPackages = with pkgs; [ - ]; - - time.timeZone = "America/Kentucky/Louisville"; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? - } - ) - ]; - } + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? + } + ) + ]; + } ); } diff --git a/nixos/machines/wsl/configuration.nix b/nixos/machines/wsl/configuration.nix index 1d6b1e0..24fa40a 100644 --- a/nixos/machines/wsl/configuration.nix +++ b/nixos/machines/wsl/configuration.nix @@ -1,72 +1,76 @@ -{ withSystem, inputs, ... }: { + withSystem, + inputs, + ... +}: { # perSystem = { ... }: { config.packages.hello = ...; }; flake.nixosConfigurations.wsl = withSystem "x86_64-linux" ( - ctx@{ config, inputs', ... }: - inputs.nixpkgs.lib.nixosSystem { - # Expose `packages`, `inputs` and `inputs'` as module arguments. - # Use specialArgs permits use in `imports`. - # Note: if you publish modules for reuse, do not rely on specialArgs, but - # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html - specialArgs = { - packages = config.packages; - inherit inputs inputs'; - }; - modules = [ - ( - # NixOS-WSL specific options are documented on the NixOS-WSL repository: - # https://github.com/nix-community/NixOS-WSL + ctx @ { + config, + inputs', + ... + }: + inputs.nixpkgs.lib.nixosSystem { + # Expose `packages`, `inputs` and `inputs'` as module arguments. + # Use specialArgs permits use in `imports`. + # Note: if you publish modules for reuse, do not rely on specialArgs, but + # on the flake scope instead. See also https://flake.parts/define-module-in-separate-file.html + specialArgs = { + packages = config.packages; + inherit inputs inputs'; + }; + modules = [ + ( + # NixOS-WSL specific options are documented on the NixOS-WSL repository: + # https://github.com/nix-community/NixOS-WSL + { + config, + lib, + pkgs, + ... + }: { + imports = [ + # WSL support + inputs.nixos-wsl.nixosModules.default + # Our modules + (import ../../modules/base.nix {inherit inputs;}) + (import ../../modules/user.nix { + inherit inputs; + mutableUsers = true; + }) + ]; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - { - config, - lib, - pkgs, - ... - }: + wsl.enable = true; + wsl.defaultUser = "nathan"; - { - imports = [ - # WSL support - inputs.nixos-wsl.nixosModules.default - # Our modules - (import ../../modules/base.nix { inherit inputs; }) - (import ../../modules/user.nix { - inherit inputs; - mutableUsers = true; - }) - ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + services.openssh.enable = true; - wsl.enable = true; - wsl.defaultUser = "nathan"; + services.tailscale.enable = true; - services.openssh.enable = true; + nix.settings.system-features = ["x86_64-linux"]; - services.tailscale.enable = true; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; - nix.settings.system-features = [ "x86_64-linux" ]; + environment.systemPackages = with pkgs; [ + ]; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; + time.timeZone = "America/Kentucky/Louisville"; - environment.systemPackages = with pkgs; [ - ]; - - time.timeZone = "America/Kentucky/Louisville"; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? - } - ) - ]; - } + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? + } + ) + ]; + } ); } diff --git a/nixos/modules/base.nix b/nixos/modules/base.nix index 8dd8681..f533040 100644 --- a/nixos/modules/base.nix +++ b/nixos/modules/base.nix @@ -1,12 +1,9 @@ -{ inputs }: -{ +{inputs}: { config, lib, pkgs, ... -}: - -{ +}: { imports = [ inputs.lix-module.nixosModules.default ]; diff --git a/nixos/modules/user.nix b/nixos/modules/user.nix index dfab48a..d17aaa6 100644 --- a/nixos/modules/user.nix +++ b/nixos/modules/user.nix @@ -3,15 +3,12 @@ mutableUsers ? false, username ? "nathan", homedir ? "/home/nathan", -}: -{ +}: { config, lib, pkgs, ... -}: - -{ +}: { security.polkit = { enable = true; }; @@ -30,6 +27,5 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEtE+KjKuHUj5bKKQBDKqhO5dpEQf8E8u1G6kRj7y6dI nathan@nixos" ]; }; - }; }