diff --git a/flake.nix b/flake.nix index f28a8fa..aa28c5b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,4 +1,6 @@ { + description = "Jimbo's systems as a flake"; + inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; unstable.url = "github:nixos/nixpkgs/nixos-unstable"; @@ -32,18 +34,19 @@ lanzaboote, home-manager, ... - } @inputs: let - inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "x86_64-linux" - ]; - in rec { - packages = forAllSystems (system: import ./packages nixpkgs.legacyPackages.${system}); - + }@inputs: let + mkNixos = modules: nixpkgs.lib.nixosSystem { + inherit modules; + specialArgs = { inherit (self) inputs outputs; }; + }; + + mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration { + inherit modules pkgs; + extraSpecialArgs = { inherit (self) inputs outputs; }; + }; + in { # Variables defined so they can be accessed globally secrets = import ./variables/secrets; - cmd = import ./variables/cmd; displays = import ./variables/displays; ips = import ./variables/ips; look = import ./variables/look; @@ -51,62 +54,40 @@ # NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - firefly = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./hosts/firefly/system - lanzaboote.nixosModules.lanzaboote - ]; - }; - cyberspark = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimServer/configuration.nix - mailserver.nixosModule - ]; - }; - shuttleworth = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimPine/configuration.nix - hardware.nixosModules.pine64-pinebook-pro - ]; - }; + firefly = mkNixos [ + ./hosts/firefly/system + lanzaboote.nixosModules.lanzaboote + ]; + cyberspark = mkNixos [ + ./system/hosts/JimServer/configuration.nix + mailserver.nixosModule + ]; + shuttleworth = mkNixos [ + ./system/hosts/JimPine/configuration.nix + hardware.nixosModules.pine64-pinebook-pro + ]; }; # Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { - "jimbo@firefly" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimDesktop/home.nix - nur.nixosModules.nur - ]; - }; - "jimbo@cyberspark" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimServer/home.nix - ]; - }; - "jimbo@shuttleworth" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimPine/home.nix - nur.nixosModules.nur - ]; - }; - # Derivation for ssh envrionments on other people's servers - "jimbo@JimTerminal" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimTerminal/home.nix - ]; - }; + "jimbo@firefly" = mkHome [ + ./hosts/firefly/home + nur.nixosModules.nur + ] nixpkgs.legacyPackages.x86_64-linux; + + "jimbo@cyberspark" = mkHome [ + ./home/hosts/JimServer/home.nix + ] nixpkgs.legacyPackages.x86_64-linux; + + "jimbo@shuttleworth" = mkHome [ + ./home/hosts/JimPine/home.nix + nur.nixosModules.nur + ] nixpkgs.legacyPackages.aarch64-linux; + + # Profile for ssh envrionments on different non-root systems + "jimbo@terminal" = mkHome [ + ./home/hosts/JimTerminal/home.nix + ] nixpkgs.legacyPackages.x86_64-linux; }; }; } diff --git a/modules/home/sway/hotkeys/default.nix b/modules/home/sway/hotkeys/default.nix index 2f74699..f5f8d23 100644 --- a/modules/home/sway/hotkeys/default.nix +++ b/modules/home/sway/hotkeys/default.nix @@ -78,7 +78,7 @@ "${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions''; # Open NixOS configuration files - "${primeMod}+F12" = ''exec foot ${outputs.cmd.nixcfg} | ${sendNotif} "Nix Config"''; + "${primeMod}+F12" = ''exec foot ranger /etc/nixos | ${sendNotif} "Nix Config"''; # Terminal, rofi, clipmenu, media script, power menu, show/hide waybar "${primeMod}+Return" = ''exec foot''; diff --git a/modules/home/utils/zsh/default.nix b/modules/home/utils/zsh/default.nix index e354e7a..9a87766 100644 --- a/modules/home/utils/zsh/default.nix +++ b/modules/home/utils/zsh/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, outputs, ... }: +{ pkgs, config, ... }: { programs.zsh = { enable = true; @@ -11,14 +11,13 @@ }; shellAliases = { # NixOS aliases - nixcfg = "${outputs.cmd.nixcfg}"; - nixclean = "${outputs.cmd.auth} nix-store --gc; nix-collect-garbage -d"; - nixpurge = "${outputs.cmd.auth} nix-collect-garbage --delete-old"; - nixoptimize = "${outputs.cmd.auth} nix store optimise"; + nixclean = "doas nix-store --gc; nix-collect-garbage -d"; + nixpurge = "doas nix-collect-garbage --delete-old"; + nixoptimize = "doas nix store optimise"; # Flake commands - flakedate = "${outputs.cmd.auth} nix flake update /etc/nixos"; - sysswitch = "${outputs.cmd.auth} nixos-rebuild switch --flake /etc/nixos"; + flakedate = "doas nix flake update /etc/nixos"; + sysswitch = "doas nixos-rebuild switch --flake /etc/nixos"; homeswitch = "home-manager switch --flake /etc/nixos"; nixswitch = "sysswitch; homeswitch"; nixdate = "flakedate && sysswitch; homeswitch"; diff --git a/overlays/default.nix b/overlays/default.nix index 88a592c..4f761ea 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,4 +1,4 @@ -{ outputs, inputs, ... }: +{ inputs, ... }: { nixpkgs.overlays = [ inputs.blender-bin.overlays.default diff --git a/variables/cmd/default.nix b/variables/cmd/default.nix deleted file mode 100644 index ecf0886..0000000 --- a/variables/cmd/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: -{ - auth = "doas"; - nixcfg = "ranger /etc/nixos"; -}