From 2d339caf57df0ece38056a9d4fb266337fbfc3fa Mon Sep 17 00:00:00 2001 From: Adrian Gunnar Lauterer Date: Sun, 31 Mar 2024 00:44:48 +0100 Subject: [PATCH] flake rework after felixalb --- flake.nix | 289 ++++++++++++++++++--------- home/shell.nix | 9 + machines/galadriel/configuration.nix | 38 +++- 3 files changed, 234 insertions(+), 102 deletions(-) create mode 100644 home/shell.nix diff --git a/flake.nix b/flake.nix index 4e72a13..90eae11 100644 --- a/flake.nix +++ b/flake.nix @@ -1,117 +1,216 @@ { - description = "stolen from PVV System flake, not currently implemented"; + description = "My System flake"; inputs = { - nixpkgs.url = "nixpkgs/nixos-23.11-small"; - nixpkgs-unstable.url = "nixpkgs/nixos-unstable-small"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + + nix-darwin.url = "github:lnl7/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + + home-manager.url = "github:nix-community/home-manager/release-23.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + matrix-synapse-next.url = "github:dali99/nixos-matrix-modules"; + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; + + # voyager-addons.url = "git+ssh://git@git.feal.no:2222/felixalb/voyager-addons.git"; + voyager-addons.url = "git+file:///home/felixalb/voyager-addons"; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; - - matrix-next.url = "github:dali99/nixos-matrix-modules"; - matrix-next.inputs.nixpkgs.follows = "nixpkgs"; - - grzegorz.url = "github:Programvareverkstedet/grzegorz"; - grzegorz.inputs.nixpkgs.follows = "nixpkgs-unstable"; - grzegorz-clients.url = "github:Programvareverkstedet/grzegorz-clients"; - grzegorz-clients.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs: - let - nixlib = nixpkgs.lib; - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; - forAllSystems = f: nixlib.genAttrs systems (system: f system); - allMachines = nixlib.mapAttrsToList (name: _: name) self.nixosConfigurations; - importantMachines = [ - "aragon" - "galadriel" - "elrond" - "georg" - ]; - in { - nixosConfigurations = let - nixosConfig = nixpkgs: name: config: nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate - rec { + outputs = { + self + , home-manager + , matrix-synapse-next + , nix-minecraft + , nixpkgs + , sops-nix + , unstable + , ... }@inputs: + let + overlay-unstable = final: prev: { + unstable = unstable.legacyPackages.${prev.system}; + }; + in + { + nixosConfigurations = { + + + # aragon = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # specialArgs = { + # inherit inputs; + # }; + # modules = [ + # # Overlays-module makes "pkgs.unstable" available in configuration.nix + # ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + + # ./machines/aragon/configuration.nix + # sops-nix.nixosModules.sops + # home-manager.nixosModules.home-manager { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users."gunalx" = import ./home/home.nix; + # } + # ]; + # }; + + + + + galadriel = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { - inherit nixpkgs-unstable inputs; - values = import ./values.nix; + inherit inputs; }; - modules = [ - ./hosts/${name}/configuration.nix + # Overlays-module makes "pkgs.unstable" available in configuration.nix + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + ./machines/galadriel/configuration.nix sops-nix.nixosModules.sops ]; + }; + - pkgs = import nixpkgs { - inherit system; - overlays = [ - inputs.pvv-calendar-bot.overlays.${system}.default - ]; + elrond = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; }; - } - config - ); - - stableNixosConfig = nixosConfig nixpkgs; - unstableNixosConfig = nixosConfig nixpkgs-unstable; - in { - bicep = stableNixosConfig "bicep" { - modules = [ - ./hosts/bicep/configuration.nix - sops-nix.nixosModules.sops - - inputs.matrix-next.nixosModules.default - inputs.pvv-calendar-bot.nixosModules.default - ]; + modules = [ + ./machines/elrond/configuration.nix + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + sops-nix.nixosModules.sops + ]; + }; }; - - #was bekkalokk - galadriel = stableNixosConfig "galadriel" { }; - - ildkule = stableNixosConfig "ildkule" { }; - - shark = stableNixosConfig "shark" { }; - - georg = stableNixosConfig "georg" { - modules = [ - ./hosts/georg/configuration.nix - sops-nix.nixosModules.sops - inputs.grzegorz.nixosModules.grzegorz-kiosk - inputs.grzegorz-clients.nixosModules.grzegorz-webui - ]; + + devShells.x86_64-linux = { + default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./home/shell.nix { }; }; - - buskerud = stableNixosConfig "buskerud" { - modules = [ - ./hosts/buskerud/configuration.nix - sops-nix.nixosModules.sops - ]; + + devShells.aarch64-linux = { + default = nixpkgs.legacyPackages.aarch64-linux.callPackage ./home/shell.nix { }; }; }; - - #devShells = forAllSystems (system: { - # default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { }; - #}); - - packages = { - "x86_64-linux" = let - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - in rec { - - default = important-machines; - - important-machines = pkgs.linkFarm "important-machines" - (nixlib.getAttrs importantMachines self.packages.x86_64-linux); - all-machines = pkgs.linkFarm "all-machines" - (nixlib.getAttrs allMachines self.packages.x86_64-linux); - } // nixlib.genAttrs allMachines - (machine: self.nixosConfigurations.${machine}.config.system.build.toplevel); - }; - }; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/home/shell.nix b/home/shell.nix new file mode 100644 index 0000000..b07c24c --- /dev/null +++ b/home/shell.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + sops + gnupg + ]; +} + + diff --git a/machines/galadriel/configuration.nix b/machines/galadriel/configuration.nix index 28adeba..6d30ecf 100644 --- a/machines/galadriel/configuration.nix +++ b/machines/galadriel/configuration.nix @@ -18,7 +18,16 @@ ../../services/stableDiffusion.nix #../../services/freshrrs.nix #../../services/torrent.nix - ]; + + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + networking.hostName = "galadriel"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -91,7 +100,7 @@ # List services that you want to enable: ##productivity - services.tandoor-recipes.enable = true; + #services.tandoor-recipes.enable = true; ##media users.groups.media.members = ["jellyfin"]; #have media directory owned by media group @@ -101,13 +110,13 @@ # services.komga.enable = true; - services.polaris.enable = true; - services.navidrome.enable = true; + #services.polaris.enable = true; + #services.navidrome.enable = true; - services.podgrab.enable = true; - services.podgrab.port = 4242; + #services.podgrab.enable = true; + #services.podgrab.port = 4242; - services.calibre-web.enable = true; + #services.calibre-web.enable = true; #services.calibre-server.enable = true; ##networking @@ -156,4 +165,19 @@ # "x-systemd.idle-timeout=600" # ]; # }; + + + + # 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 = "23.11"; # Did you read the comment? + + + + + }