From 409f8a758fb14e67dcb67062ff819042ce95b81e Mon Sep 17 00:00:00 2001 From: sstent Date: Fri, 26 Jan 2024 02:28:50 +0000 Subject: [PATCH] sync --- flake.nix | 224 +++++++++++++------------- home-manager/global.nix | 14 +- home-manager/users/sstent/default.nix | 4 +- hosts/common.nix | 17 +- hosts/commonold.nix | 179 -------------------- 5 files changed, 124 insertions(+), 314 deletions(-) delete mode 100644 hosts/commonold.nix diff --git a/flake.nix b/flake.nix index d815125..5a9441e 100644 --- a/flake.nix +++ b/flake.nix @@ -54,129 +54,125 @@ utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; }; - outputs = { - self, - nixpkgs, - home-manager, - nixpkgs-unstable, - ... - } @ inputs: let - inherit (lib.my) mapModules mapModulesRec mapHosts; - inherit (self) outputs; + outputs = + { self + , nixpkgs + , home-manager + , nixpkgs-unstable + , ... + } @ inputs: + let + inherit (lib.my) mapModules mapModulesRec mapHosts; + inherit (self) outputs; - system = "x86_64-linux"; + system = "x86_64-linux"; - mkPkgs = pkgs: extraOverlays: - import pkgs { + pkgs = import nixpkgs { inherit system; - config.allowUnfree = true; # forgive me Stallman senpai - overlays = extraOverlays ++ (lib.attrValues self.overlays); + config.allowUnfree = true; + overlays = builtins.attrValues self.overlays; }; - # pkgs = mkPkgs nixpkgs [self.overlay]; - pkgs = mkPkgs nixpkgs []; - # pkgs' = mkPkgs nixpkgs-unstable []; - lib = - nixpkgs.lib.extend - (self: super: - { - my = import ./lib { - inherit pkgs inputs outputs; - lib = self; + + lib = + nixpkgs.lib.extend + (self: super: + { + my = import ./lib { + inherit pkgs inputs outputs; + lib = self; + }; + } + // home-manager.lib); + in + { + lib = lib.my; + packages."${system}" = mapModules ./pkgs (p: pkgs.callPackage p { }); + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + + devShell."${system}" = + import ./shell.nix { inherit pkgs; }; + + + ##Loads all overlays in the default.nix + ##This gets used as an input to the pkg definitiosn + overlays = import ./overlays { inherit inputs; }; + + # Output all NixOS modules in ./modules/nixos to flake. Modules should be in + # individual subdirectories and contain a default.nix file + nixosModules = builtins.listToAttrs (map + (x: { + name = x; + value = import (./modules/nixos + "/${x}"); + }) + (builtins.attrNames (builtins.readDir ./modules/nixos))); + + ##import our HM modulesin ./modules/home-manager to flake. Modules should be in + # individual subdirectories and contain a default.nix file + homeManagerModules = builtins.listToAttrs (map + (name: { + inherit name; + value = import (./modules/home-manager + "/${name}"); + }) + (builtins.attrNames (builtins.readDir ./modules/home-manager))); + + # nixosConfigurations = + # mapHosts ./hosts {}; + + # NixOS configuration entrypoint + nixosConfigurations = { + go3-wsl = nixpkgs.lib.nixosSystem { + pkgs = pkgs; + specialArgs = { + inherit inputs outputs lib; + hostName = "go3-wsl"; }; - } - // home-manager.lib); - in { - lib = lib.my; - packages."${system}" = mapModules ./pkgs (p: pkgs.callPackage p {}); - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; - - devShell."${system}" = - import ./shell.nix {inherit pkgs;}; - - # overlay = final: prev: { - # unstable = pkgs'; - # my = self.packages."${system}"; - # keybase = pkgs'.keybase; - # }; - - overlays = import ./overlays {inherit inputs;}; - - # Output all modules in ./modules to flake. Modules should be in - # individual subdirectories and contain a default.nix file - nixosModules = builtins.listToAttrs (map - (x: { - name = x; - value = import (./modules/nixos + "/${x}"); - }) - (builtins.attrNames (builtins.readDir ./modules/nixos))); - - ##import our HM modules - ## -- imported in ./home-manger/general - - homeManagerModules = builtins.listToAttrs (map - (name: { - inherit name; - value = import (./modules/home-manager + "/${name}"); - }) - (builtins.attrNames (builtins.readDir ./modules/home-manager))); - - # nixosConfigurations = - # mapHosts ./hosts {}; - - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - go3-wsl = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs lib; - hostName = "go3-wsl"; + modules = [ + ./hosts/go3-wsl + ]; + }; + StuPC-WSL = nixpkgs.lib.nixosSystem { + pkgs = pkgs; + specialArgs = { + inherit inputs outputs lib; + hostName = "StuPC"; + }; + modules = [ + ./hosts/StuPC-WSL + ]; }; - modules = [ - ./hosts/go3-wsl - ]; }; - StuPC-WSL = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs lib; - hostName = "StuPC"; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + # FIXME replace with your username@hostname + "sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + pkgs = pkgs; + extraSpecialArgs = { + inherit inputs outputs lib; + hostName = "go3-wsl"; + }; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/users/sstent + inputs.sops-nix.homeManagerModules.sops + ]; + }; + "sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + pkgs = pkgs; + extraSpecialArgs = { + inherit inputs outputs lib; + hostName = "StuPC-WSL"; + }; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/users/sstent + inputs.sops-nix.homeManagerModules.sops + ]; }; - modules = [ - ./hosts/StuPC-WSL - ]; }; }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - # FIXME replace with your username@hostname - "sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration { - # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - pkgs = pkgs; - extraSpecialArgs = { - inherit inputs outputs lib; - hostName = "go3-wsl"; - }; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/users/sstent - inputs.sops-nix.homeManagerModules.sops - ]; - }; - "sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration { - # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - pkgs = pkgs; - extraSpecialArgs = { - inherit inputs outputs lib; - hostName = "StuPC-WSL"; - }; - modules = [ - # > Our main home-manager configuration file < - ./home-manager/users/sstent - inputs.sops-nix.homeManagerModules.sops - ]; - }; - }; - }; } diff --git a/home-manager/global.nix b/home-manager/global.nix index 8568ab0..f857d98 100644 --- a/home-manager/global.nix +++ b/home-manager/global.nix @@ -36,13 +36,13 @@ }; config = { - nixpkgs = { - overlays = builtins.attrValues outputs.overlays; - config = { - allowUnfree = true; - allowUnfreePredicate = _: true; - }; - }; + # nixpkgs = { + # overlays = builtins.attrValues outputs.overlays; + # config = { + # allowUnfree = true; + # allowUnfreePredicate = _: true; + # }; + # }; nix = { package = lib.mkDefault pkgs.nix; diff --git a/home-manager/users/sstent/default.nix b/home-manager/users/sstent/default.nix index 26025a5..ffb897c 100644 --- a/home-manager/users/sstent/default.nix +++ b/home-manager/users/sstent/default.nix @@ -30,7 +30,7 @@ #home.file."/home/sstent/.config/bash-completions/mr.bash".source = ./mr_completion.bash; # home.file."/home/sstent/justfile".source = ./justfile; home.file."/home/sstent/justfile".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/vmimages/dotfiles/${config.home.username}/justfile"; - home.file."/home/sstent/.config/bash-completions/nomad_.bash".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/vmimages/dotfiles/${config.home.username}/nomad_.bash"; + home.file.".bash_completion".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/vmimages/dotfiles/${config.home.username}/nomad_.bash"; # home.file."/home/sstent/.config/beets/test".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test; @@ -110,7 +110,7 @@ do alias $command="just $command" done - + ''; }; diff --git a/hosts/common.nix b/hosts/common.nix index f9d4eb4..dbccc0c 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -51,30 +51,23 @@ ]; }; - nixpkgs.config.allowUnfree = true; programs.fuse.userAllowOther = true; security.sudo.wheelNeedsPassword = false; virtualisation.docker.enable = true; - nixpkgs.overlays = builtins.attrValues outputs.overlays; - # nixpkgs.overlays = [ - # outputs.overlays.unstable-packages - # outputs.overlays.modifications - # outputs.overlays.additions - # ]; # Enable nix flakes nix.package = pkgs.nixFlakes; nix.extraOptions = '' experimental-features = nix-command flakes ''; nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"]; - # nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; - networking.search = ["node.dc1.consul" "service.dc1.consul"]; - networking.nameservers = ["192.168.1.1" "1.1.1.1"]; + # Enable networking networking.networkmanager.enable = true; - - # Select internationalisation properties. + networking.search = ["node.dc1.consul" "service.dc1.consul"]; + networking.nameservers = ["192.168.1.1" "1.1.1.1"]; + + # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; i18n.extraLocaleSettings = { diff --git a/hosts/commonold.nix b/hosts/commonold.nix deleted file mode 100644 index 9b8b1c1..0000000 --- a/hosts/commonold.nix +++ /dev/null @@ -1,179 +0,0 @@ -<<<<<<< HEAD -# This file (and the global directory) holds config that i use on all hosts -{ - lib, - inputs, - outputs, - pkgs, - config, - ... -}: { - imports = - [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - ] - ++ (builtins.attrValues outputs.nixosModules); - - ###dotfiles path variable - options._dotfiles = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/home-manager/dotfiles"; - description = "Path to the dotfiles in this repository"; - }; - - ###secrets path variable - options._secrets = lib.mkOption { - type = lib.types.str; - default = "/run/user/1000/secrets"; - description = "Path to the Secrets runtime"; - }; - - ###secretstore path variable - options._secretstore = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/secrets"; - description = "Path to the Secrets storage"; - }; - - config = { - system.stateVersion = "23.05"; - - sops = { - defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; - age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; - }; - - home-manager = { - useUserPackages = true; - extraSpecialArgs = {inherit inputs outputs;}; - sharedModules = [ - inputs.sops-nix.homeManagerModules.sops - ]; - }; - - nixpkgs.config.allowUnfree = true; - programs.fuse.userAllowOther = true; - security.sudo.wheelNeedsPassword = false; - - # nixpkgs.overlays = overlays; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"]; - # nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; - networking.search = ["node.dc1.consul" "service.dc1.consul"]; - - #services.envfs.enable = true; - environment.systemPackages = [ - pkgs.git - pkgs.home-manager - pkgs.sops - pkgs.ssh-to-age - pkgs.age - pkgs.bitwarden-cli - ]; - - nix.gc = { - automatic = true; # Enable the automatic garbage collector - dates = "03:15"; # When to run the garbage collector - options = "-d"; # Arguments to pass to nix-collect-garbage - }; - }; -} -======= -# This file (and the global directory) holds config that i use on all hosts -{ lib, inputs, outputs, pkgs, config, ... }: -{ - imports = [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - # ./binfmt.nix - ]++ (builtins.attrValues outputs.nixosModules); - -###dotfiles path variable - options._dotfiles = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/home-manager/dotfiles"; - description = "Path to the dotfiles in this repository"; - }; - -###secrets path variable - options._secrets = lib.mkOption { - type = lib.types.str; - default = "/run/user/1000/secrets"; - description = "Path to the Secrets runtime"; - }; - - -###secretstore path variable - options._secretstore = lib.mkOption { - type = lib.types.str; - default = "${inputs.self}/secrets"; - description = "Path to the Secrets storage"; - }; - -config = { - system.stateVersion = "23.05"; - - - sops = { - defaultSopsFile = "${config._secretstore}/host-secrets.yaml"; - age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; -}; - - - home-manager = { - useUserPackages = true; - extraSpecialArgs = { inherit inputs outputs; }; - sharedModules = [ - inputs.sops-nix.homeManagerModules.sops - ]; - }; - - nixpkgs.config.allowUnfree = true; - programs.fuse.userAllowOther = true; - security.sudo.wheelNeedsPassword = false; - - # nixpkgs.overlays = overlays; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; -nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; -# nix.extra-platforms = aarch64-linux i686-linux; - -# nix.nixPath = [ "nixpkgs=pkgs.outPath" ]; -# boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; -boot.binfmt.emulatedSystems = ["armv7l-linux" "aarch64-linux"]; - -nix.settings.substituters = [ - "https://fbleagh.cachix.org" - "https://cache.armv7l.xyz" - "https://arm.cachix.org" - "https://thefloweringash-armv7.cachix.org" ]; -nix.settings.trusted-public-keys = [ - "fbleagh.cachix.org-1:HNgEVkx9HfKmEQdR+9IeCwqFza0k8d8fJgcYvOTVDB8=" - "cache.armv7l.xyz-1:kBY/eGnBAYiqYfg0fy0inWhshUo+pGFM3Pj7kIkmlBk=" - "arm.cachix.org-1:K3XjAeWPgWkFtSS9ge5LJSLw3xgnNqyOaG7MDecmTQ8=" - "thefloweringash-armv7.cachix.org-1:v+5yzBD2odFKeXbmC+OPWVqx4WVoIVO6UXgnSAWFtso=" -]; -nix.settings.trusted-users = [ "root" "sstent" ]; - -#services.envfs.enable = true; - environment.systemPackages = [ - pkgs.git - pkgs.home-manager - pkgs.sops - pkgs.ssh-to-age - pkgs.age - pkgs.qemu - pkgs.cachix - ]; - -}; -} ->>>>>>> dacf7df (updates)