Going to be changing the way I do variables I think, remove the cmd var

This commit is contained in:
Jimbo 2024-10-13 02:23:51 -04:00
parent cd92b28dc6
commit fa3890b814
5 changed files with 51 additions and 76 deletions

105
flake.nix
View file

@ -1,4 +1,6 @@
{ {
description = "Jimbo's systems as a flake";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable"; unstable.url = "github:nixos/nixpkgs/nixos-unstable";
@ -32,18 +34,19 @@
lanzaboote, lanzaboote,
home-manager, home-manager,
... ...
} @inputs: let }@inputs: let
inherit (self) outputs; mkNixos = modules: nixpkgs.lib.nixosSystem {
forAllSystems = nixpkgs.lib.genAttrs [ inherit modules;
"aarch64-linux" specialArgs = { inherit (self) inputs outputs; };
"x86_64-linux" };
];
in rec { mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration {
packages = forAllSystems (system: import ./packages nixpkgs.legacyPackages.${system}); inherit modules pkgs;
extraSpecialArgs = { inherit (self) inputs outputs; };
};
in {
# Variables defined so they can be accessed globally # Variables defined so they can be accessed globally
secrets = import ./variables/secrets; secrets = import ./variables/secrets;
cmd = import ./variables/cmd;
displays = import ./variables/displays; displays = import ./variables/displays;
ips = import ./variables/ips; ips = import ./variables/ips;
look = import ./variables/look; look = import ./variables/look;
@ -51,62 +54,40 @@
# NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname' # NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
firefly = nixpkgs.lib.nixosSystem { firefly = mkNixos [
specialArgs = {inherit inputs outputs;}; ./hosts/firefly/system
modules = [ lanzaboote.nixosModules.lanzaboote
./hosts/firefly/system ];
lanzaboote.nixosModules.lanzaboote cyberspark = mkNixos [
]; ./system/hosts/JimServer/configuration.nix
}; mailserver.nixosModule
cyberspark = nixpkgs.lib.nixosSystem { ];
specialArgs = {inherit inputs outputs;}; shuttleworth = mkNixos [
modules = [ ./system/hosts/JimPine/configuration.nix
./system/hosts/JimServer/configuration.nix hardware.nixosModules.pine64-pinebook-pro
mailserver.nixosModule ];
];
};
shuttleworth = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./system/hosts/JimPine/configuration.nix
hardware.nixosModules.pine64-pinebook-pro
];
};
}; };
# Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname' # Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
"jimbo@firefly" = home-manager.lib.homeManagerConfiguration { "jimbo@firefly" = mkHome [
pkgs = nixpkgs.legacyPackages.x86_64-linux; ./hosts/firefly/home
extraSpecialArgs = {inherit inputs outputs;}; nur.nixosModules.nur
modules = [ ] nixpkgs.legacyPackages.x86_64-linux;
./home/hosts/JimDesktop/home.nix
nur.nixosModules.nur "jimbo@cyberspark" = mkHome [
]; ./home/hosts/JimServer/home.nix
}; ] nixpkgs.legacyPackages.x86_64-linux;
"jimbo@cyberspark" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; "jimbo@shuttleworth" = mkHome [
extraSpecialArgs = {inherit inputs outputs;}; ./home/hosts/JimPine/home.nix
modules = [ nur.nixosModules.nur
./home/hosts/JimServer/home.nix ] nixpkgs.legacyPackages.aarch64-linux;
];
}; # Profile for ssh envrionments on different non-root systems
"jimbo@shuttleworth" = home-manager.lib.homeManagerConfiguration { "jimbo@terminal" = mkHome [
pkgs = nixpkgs.legacyPackages.aarch64-linux; ./home/hosts/JimTerminal/home.nix
extraSpecialArgs = {inherit inputs outputs;}; ] nixpkgs.legacyPackages.x86_64-linux;
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
];
};
}; };
}; };
} }

View file

@ -78,7 +78,7 @@
"${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions''; "${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions'';
# Open NixOS configuration files # 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 # Terminal, rofi, clipmenu, media script, power menu, show/hide waybar
"${primeMod}+Return" = ''exec foot''; "${primeMod}+Return" = ''exec foot'';

View file

@ -1,4 +1,4 @@
{ pkgs, config, outputs, ... }: { pkgs, config, ... }:
{ {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -11,14 +11,13 @@
}; };
shellAliases = { shellAliases = {
# NixOS aliases # NixOS aliases
nixcfg = "${outputs.cmd.nixcfg}"; nixclean = "doas nix-store --gc; nix-collect-garbage -d";
nixclean = "${outputs.cmd.auth} nix-store --gc; nix-collect-garbage -d"; nixpurge = "doas nix-collect-garbage --delete-old";
nixpurge = "${outputs.cmd.auth} nix-collect-garbage --delete-old"; nixoptimize = "doas nix store optimise";
nixoptimize = "${outputs.cmd.auth} nix store optimise";
# Flake commands # Flake commands
flakedate = "${outputs.cmd.auth} nix flake update /etc/nixos"; flakedate = "doas nix flake update /etc/nixos";
sysswitch = "${outputs.cmd.auth} nixos-rebuild switch --flake /etc/nixos"; sysswitch = "doas nixos-rebuild switch --flake /etc/nixos";
homeswitch = "home-manager switch --flake /etc/nixos"; homeswitch = "home-manager switch --flake /etc/nixos";
nixswitch = "sysswitch; homeswitch"; nixswitch = "sysswitch; homeswitch";
nixdate = "flakedate && sysswitch; homeswitch"; nixdate = "flakedate && sysswitch; homeswitch";

View file

@ -1,4 +1,4 @@
{ outputs, inputs, ... }: { inputs, ... }:
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
inputs.blender-bin.overlays.default inputs.blender-bin.overlays.default

View file

@ -1,5 +0,0 @@
{ ... }:
{
auth = "doas";
nixcfg = "ranger /etc/nixos";
}