refactor: use inputs.self instead of rel. paths

This commit is contained in:
Swarsel 2024-12-05 02:36:25 +01:00
parent 83bc6af1f6
commit 33046cb4a3
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
19 changed files with 1067 additions and 1711 deletions

View file

@ -508,6 +508,12 @@ Lastly I define some common module lists that I can simply load depending on the
./profiles/common/home ./profiles/common/home
]; ];
# For adding things to _module.args (making arguments available globally)
# moduleArgs = [
# {
# _module.args = { inherit self; };
# }
# ];
#+end_src #+end_src
*** General (outputs) *** General (outputs)
:PROPERTIES: :PROPERTIES:
@ -530,6 +536,7 @@ In this section I am creating some attributes that define general concepts of my
inherit lib; inherit lib;
inherit mixedModules; inherit mixedModules;
# inherit moduleArgs;
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home; homeManagerModules = import ./modules/home;
@ -838,7 +845,10 @@ My work machine. Built for more security, this is the gold standard of my config
#+begin_src nix :tangle profiles/nbl-imba-2/default.nix #+begin_src nix :tangle profiles/nbl-imba-2/default.nix
{ inputs, outputs, config, pkgs, lib, ... }: { self, inputs, outputs, config, pkgs, lib, ... }:
let
profilesPath = "${self}/profiles";
in
{ {
imports = [ imports = [
@ -848,18 +858,18 @@ My work machine. Built for more security, this is the gold standard of my config
./hardware-configuration.nix ./hardware-configuration.nix
./disk-config.nix ./disk-config.nix
../optional/nixos/steam.nix "${profilesPath}/optional/nixos/steam.nix"
../optional/nixos/virtualbox.nix "${profilesPath}/optional/nixos/virtualbox.nix"
# ../optional/nixos/vmware.nix # ../optional/nixos/vmware.nix
../optional/nixos/autologin.nix "${profilesPath}/optional/nixos/autologin.nix"
../optional/nixos/nswitch-rcm.nix "${profilesPath}/optional/nixos/nswitch-rcm.nix"
../optional/nixos/work.nix "${profilesPath}/optional/nixos/work.nix"
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = outputs.mixedModules ++ [ home-manager.users.swarsel.imports = outputs.mixedModules ++ [
../optional/home/gaming.nix "${profilesPath}/optional/home/gaming.nix"
../optional/home/work.nix "${profilesPath}/optional/home/work.nix"
] ++ (builtins.attrValues outputs.homeManagerModules); ] ++ (builtins.attrValues outputs.homeManagerModules);
} }
] ++ (builtins.attrValues outputs.nixosModules); ] ++ (builtins.attrValues outputs.nixosModules);
@ -916,7 +926,7 @@ My work machine. Built for more security, this is the gold standard of my config
}; };
swarselsystems = { swarselsystems = {
wallpaper = ../../wallpaper/lenovowp.png; wallpaper = self + /wallpaper/lenovowp.png;
hasBluetooth = true; hasBluetooth = true;
hasFingerprint = true; hasFingerprint = true;
impermanence = false; impermanence = false;
@ -1059,7 +1069,10 @@ My work machine. Built for more security, this is the gold standard of my config
#+begin_src nix :tangle profiles/server/winters/default.nix #+begin_src nix :tangle profiles/server/winters/default.nix
{ inputs, outputs, config, ... }: { self, inputs, outputs, config, ... }:
let
profilesPath = "${self}/profiles";
in
{ {
imports = [ imports = [
@ -1067,8 +1080,15 @@ My work machine. Built for more security, this is the gold standard of my config
./hardware-configuration.nix ./hardware-configuration.nix
../../optional/nixos/autologin.nix "${profilesPath}/optional/nixos/autologin.nix"
../../server/common "${profilesPath}/server/common/nixos"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users.swarsel.imports = [
"${profilesPath}/server/common/home"
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules); ] ++ (builtins.attrValues outputs.nixosModules);
@ -1116,6 +1136,7 @@ My work machine. Built for more security, this is the gold standard of my config
syncthing = true; syncthing = true;
monitoring = true; monitoring = true;
jenkins = false; jenkins = false;
emacs = false;
}; };
}; };
@ -1128,7 +1149,7 @@ My work machine. Built for more security, this is the gold standard of my config
#+begin_src nix :tangle profiles/nbm-imba-166/default.nix #+begin_src nix :tangle profiles/nbm-imba-166/default.nix
{ inputs, outputs, config, pkgs, lib, ... }: { inputs, outputs, config, ... }:
{ {
imports = [ imports = [
@ -2563,6 +2584,7 @@ I usually use =mutableUsers = false= in my NixOS configuration. However, on a ne
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server"; options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server";
options.swarselsystems.server.emacs = lib.mkEnableOption "enable emacs server on server";
} }
#+end_src #+end_src
@ -2872,7 +2894,7 @@ These are some extra options that will be used if the machine also runs NixOS. F
***** darwin ***** darwin
#+begin_src nix :noweb yes :tangle modules/home/darwin.nix #+begin_src nix :noweb yes :tangle modules/home/darwin.nix
{ lib, config, ... }: { lib, ... }:
{ {
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host"; options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
} }
@ -2962,25 +2984,15 @@ Here we have NixOS options. All options are split into smaller files that are lo
These are system-level settings specific to NixOS machines. All settings that are required on all machines go here. These are system-level settings specific to NixOS machines. All settings that are required on all machines go here.
**** Imports, enable home-manager module, stateVersion **** Imports, non-server settings
:PROPERTIES:
:CUSTOM_ID: h:ae1f4d4d-02a9-403f-8179-78889ce57fb8
:END:
:PROPERTIES: This section is for setting things that should be used on hosts that are using the default NixOS configuration. This means that servers should NOT import this, as much of these imported modules are user-configured.
:CUSTOM_ID: h:45e4315b-0929-4c47-b65a-c8f0a685f4df
:END:
First, we enable the use of =home-manager= as a NixoS module.
Also, we disable the warnings that trigger when rebuilding with a dirty flake. At this point, I am also disabling channels and pinning the flake registry - the latter lets me use the local version of nixpkgs for commands like =nix shell= (without it, we will always download the newest version of nixpkgs for these commands).
Also, the system state version is set here. No need to touch it.
#+begin_src nix :tangle profiles/common/nixos/default.nix #+begin_src nix :tangle profiles/common/nixos/default.nix
{ lib, inputs, ... }: _:
{ {
imports = [ imports = [
./settings.nix
./xserver.nix ./xserver.nix
./users.nix ./users.nix
./env.nix ./env.nix
@ -3018,6 +3030,26 @@ Also, the system state version is set here. No need to touch it.
./lid.nix ./lid.nix
]; ];
nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8043"
"electron-29.4.6"
];
}
#+end_src
**** General NixOS settings (enable home-manager module, stateVersion)
First, we enable the use of =home-manager= as a NixoS module.
Also, we disable the warnings that trigger when rebuilding with a dirty flake. At this point, I am also disabling channels and pinning the flake registry - the latter lets me use the local version of nixpkgs for commands like =nix shell= (without it, we will always download the newest version of nixpkgs for these commands).
Also, the system state version is set here. No need to touch it.
#+begin_src nix :tangle profiles/common/nixos/settings.nix
{ lib, inputs, ... }:
{
nix = nix =
let let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
@ -3038,19 +3070,15 @@ Also, the system state version is set here. No need to touch it.
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
}; };
nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8043"
"electron-29.4.6"
];
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = inputs; # used mainly for inputs.self
}; };
system.stateVersion = lib.mkDefault "23.05"; system.stateVersion = lib.mkDefault "23.05";
}
}
#+end_src #+end_src
**** Setup login keymap **** Setup login keymap
@ -3142,6 +3170,7 @@ Needed for control over system-wide privileges etc.
}; };
security.polkit.enable = true; security.polkit.enable = true;
} }
#+end_src #+end_src
@ -3510,7 +3539,7 @@ Here I only enable =networkmanager=. Most of the 'real' network config is done i
proxy = { }; proxy = { };
wifi = { wifi = {
mode = "ap"; mode = "ap";
ssid = "Hotspot-fourside"; ssid = "Hotspot-swarsel";
}; };
wifi-security = { wifi-security = {
group = "ccmp;"; group = "ccmp;";
@ -4481,7 +4510,7 @@ This turns off the display when the lid is closed.
#+end_src #+end_src
*** Server *** Server
**** Imports, stateVersion **** Imports
First, we enable the use of =home-manager= as a NixoS module. First, we enable the use of =home-manager= as a NixoS module.
@ -4489,17 +4518,22 @@ Also, we disable the warnings that trigger when rebuilding with a dirty flake. A
Also, the system state version is set here. No need to touch it. Also, the system state version is set here. No need to touch it.
#+begin_src nix :tangle profiles/server/common/default.nix #+begin_src nix :tangle profiles/server/common/nixos/default.nix
{ lib, config, inputs, ... }: { self, ... }:
{ let
profilesPath = "${self}/profiles";
in
{
imports = [ imports = [
../../common/nixos/xserver.nix "${profilesPath}/common/nixos/settings.nix"
../../common/nixos/gc.nix "${profilesPath}/common/nixos/xserver.nix"
../../common/nixos/store.nix "${profilesPath}/common/nixos/gc.nix"
../../common/nixos/time.nix "${profilesPath}/common/nixos/store.nix"
../../common/nixos/pipewire.nix "${profilesPath}/common/nixos/time.nix"
../../common/nixos/users.nix "${profilesPath}/common/nixos/pipewire.nix"
../../common/nixos/nix-ld.nix "${profilesPath}/common/nixos/users.nix"
"${profilesPath}/common/nixos/nix-ld.nix"
./settings.nix
./packages.nix ./packages.nix
./sops.nix ./sops.nix
./ssh.nix ./ssh.nix
@ -4519,28 +4553,16 @@ Also, the system state version is set here. No need to touch it.
./restic.nix ./restic.nix
./monitoring.nix ./monitoring.nix
./jenkins.nix ./jenkins.nix
./emacs.nix
]; ];
}
#+end_src
nix = **** General NixOS Server settings
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; #+begin_src nix :tangle profiles/server/common/nixos/settings.nix
in { lib, config, ... }:
{ {
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
environment.shellAliases = lib.recursiveUpdate environment.shellAliases = lib.recursiveUpdate
{ {
npswitch = "cd ${config.swarselsystems.flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;"; npswitch = "cd ${config.swarselsystems.flakePath}; git pull; sudo nixos-rebuild --flake .#$(hostname) switch --impure; cd -;";
@ -4552,14 +4574,12 @@ Also, the system state version is set here. No need to touch it.
"olm-3.2.16" "olm-3.2.16"
]; ];
system.stateVersion = lib.mkDefault "23.05"; }
} #+end_src
#+end_src
**** System Packages **** System Packages
#+begin_src nix :tangle profiles/server/common/packages.nix #+begin_src nix :tangle profiles/server/common/nixos/packages.nix
{ pkgs, ... }: { pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -6238,12 +6258,13 @@ The general structure is the same as in the [[#h:6da812f5-358c-49cb-aff2-0a94f20
:CUSTOM_ID: h:16fd2e85-fdd4-440a-81f0-65b9b098a43a :CUSTOM_ID: h:16fd2e85-fdd4-440a-81f0-65b9b098a43a
:END: :END:
This section sets up all the imports that are used in the home-manager section. Again, we adapt =nix= to our needs, enable the home-manager command for non-NixOS machines (NixOS machines are using it as a module) and setting user information that I always keep the same. This section sets up all the imports that are used in the home-manager section.
#+begin_src nix :tangle profiles/common/home/default.nix #+begin_src nix :tangle profiles/common/home/default.nix
{ lib, pkgs, config, ... }: _:
{ {
imports = [ imports = [
./settings.nix
./packages.nix ./packages.nix
./custom-packages.nix ./custom-packages.nix
./sops.nix ./sops.nix
@ -6277,7 +6298,16 @@ This section sets up all the imports that are used in the home-manager section.
./zellij.nix ./zellij.nix
./tmux.nix ./tmux.nix
]; ];
}
#+end_src
**** General home-manager-settings
Again, we adapt =nix= to our needs, enable the home-manager command for non-NixOS machines (NixOS machines are using it as a module) and setting user information that I always keep the same.
#+begin_src nix :tangle profiles/common/home/settings.nix
{ lib, config, pkgs, ... }:
{
nix = { nix = {
package = lib.mkDefault pkgs.nix; package = lib.mkDefault pkgs.nix;
settings = { settings = {
@ -6300,7 +6330,6 @@ This section sets up all the imports that are used in the home-manager section.
FLAKE = "$HOME/.dotfiles"; FLAKE = "$HOME/.dotfiles";
}; };
}; };
} }
#+end_src #+end_src
@ -6764,28 +6793,28 @@ This section should be used in order to symlink already existing configuration f
As for the `home.sessionVariables`, it should be noted that environment variables that are needed at system start should NOT be loaded here, but instead in `programs.zsh.config.extraSessionCommands` (in the home-manager programs section). This is also where all the wayland related variables are stored. As for the `home.sessionVariables`, it should be noted that environment variables that are needed at system start should NOT be loaded here, but instead in `programs.zsh.config.extraSessionCommands` (in the home-manager programs section). This is also where all the wayland related variables are stored.
#+begin_src nix :tangle profiles/common/home/symlink.nix #+begin_src nix :tangle profiles/common/home/symlink.nix
_: { self, ... }:
{ {
home.file = { home.file = {
"init.el" = { "init.el" = {
source = ../../../programs/emacs/init.el; source = self + /programs/emacs/init.el;
target = ".emacs.d/init.el"; target = ".emacs.d/init.el";
}; };
"early-init.el" = { "early-init.el" = {
source = ../../../programs/emacs/early-init.el; source = self + /programs/emacs/early-init.el;
target = ".emacs.d/early-init.el"; target = ".emacs.d/early-init.el";
}; };
# on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually # on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually
".aspell.conf" = { ".aspell.conf" = {
source = ../../../programs/config/.aspell.conf; source = self + /programs/config/.aspell.conf;
target = ".aspell.conf"; target = ".aspell.conf";
}; };
".gitmessage" = { ".gitmessage" = {
source = ../../../programs/git/.gitmessage; source = self + /programs/git/.gitmessage;
target = ".gitmessage"; target = ".gitmessage";
}; };
"swayidle/config" = { "swayidle/config" = {
source = ../../../programs/swayidle/config; source = self + /programs/swayidle/config;
target = ".config/swayidle/config"; target = ".config/swayidle/config";
}; };
}; };
@ -6797,8 +6826,8 @@ Also in firefox `about:config > toolkit.legacyUserProfileCustomizations.styleshe
#+begin_src nix :tangle profiles/common/home/symlink.nix #+begin_src nix :tangle profiles/common/home/symlink.nix
xdg.configFile = { xdg.configFile = {
"tridactyl/tridactylrc".source = ../../../programs/firefox/tridactyl/tridactylrc; "tridactyl/tridactylrc".source = self + /programs/firefox/tridactyl/tridactylrc;
"tridactyl/themes/base16-codeschool.css".source = ../../../programs/firefox/tridactyl/themes/base16-codeschool.css; "tridactyl/themes/base16-codeschool.css".source = self + /programs/firefox/tridactyl/themes/base16-codeschool.css;
}; };
} }
#+end_src #+end_src
@ -6858,13 +6887,13 @@ This section is for programs that require no further configuration. zsh Integrat
nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for =command-not-found.sh=, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output. nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for =command-not-found.sh=, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output.
#+begin_src nix :tangle profiles/common/home/nix-index.nix #+begin_src nix :tangle profiles/common/home/nix-index.nix
{ pkgs, ... }: { self, pkgs, ... }:
{ {
programs.nix-index = programs.nix-index =
let let
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } '' commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
mkdir -p $out/etc/profile.d mkdir -p $out/etc/profile.d
substitute ${../../../scripts/command-not-found.sh} \ substitute ${self + /scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \ $out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \ --replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput --replace @tput@ ${pkgs.ncurses}/bin/tput
@ -7743,14 +7772,14 @@ By using the emacs-overlay NixOS module, I can install all Emacs packages that I
Lastly, I am defining some more packages here that the parser has problems finding. Also there are some packages that are not in ELPA or MELPA that I still want to use, like =calfw= and =fast-scroll=, so I build them here. Lastly, I am defining some more packages here that the parser has problems finding. Also there are some packages that are not in ELPA or MELPA that I still want to use, like =calfw= and =fast-scroll=, so I build them here.
#+begin_src nix :tangle profiles/common/home/emacs.nix #+begin_src nix :tangle profiles/common/home/emacs.nix
{ pkgs, ... }: { self, pkgs, ... }:
{ {
# enable emacs overlay for bleeding edge features # enable emacs overlay for bleeding edge features
# also read init.el file and install use-package packages # also read init.el file and install use-package packages
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacsWithPackagesFromUsePackage { package = pkgs.emacsWithPackagesFromUsePackage {
config = ../../../programs/emacs/init.el; config = self + /programs/emacs/init.el;
package = pkgs.emacs-pgtk; package = pkgs.emacs-pgtk;
alwaysEnsure = true; alwaysEnsure = true;
alwaysTangle = true; alwaysTangle = true;
@ -7811,7 +7840,7 @@ The rest of the related configuration is found here:
- [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]] - [[#h:f93f66f9-6b8b-478e-b139-b2f382c1f25e][waybarupdate]]
#+begin_src nix :tangle profiles/common/home/waybar.nix #+begin_src nix :tangle profiles/common/home/waybar.nix
{ config, lib, ... }: { self, config, lib, ... }:
{ {
programs.waybar = { programs.waybar = {
@ -8072,7 +8101,7 @@ The rest of the related configuration is found here:
}; };
}; };
}; };
style = builtins.readFile ../../../programs/waybar/style.css; style = builtins.readFile (self + /programs/waybar/style.css);
}; };
} }
#+end_src #+end_src
@ -8839,6 +8868,42 @@ This service changes the screen hue at night. I am not sure if that really does
} }
#+end_src #+end_src
*** Server
**** Imports
This section sets up all the imports that are used in the home-manager section.
#+begin_src nix :tangle profiles/server/common/home/default.nix
{ self, ... }:
let
profilesPath = "${self}/profiles";
in
{
imports = [
"${profilesPath}/common/home/settings.nix"
./symlink.nix
];
}
#+end_src
**** Linking dotfiles
This section should be used in order to symlink already existing configuration files using `home.file` and setting session variables using `home.sessionVariables`.
As for the `home.sessionVariables`, it should be noted that environment variables that are needed at system start should NOT be loaded here, but instead in `programs.zsh.config.extraSessionCommands` (in the home-manager programs section). This is also where all the wayland related variables are stored.
#+begin_src nix :tangle profiles/server/common/home/symlink.nix
{ self, ... }:
{
home.file = {
"init.el" = {
source = self + /programs/emacs/server.el;
target = ".emacs.d/init.el";
};
};
}
#+end_src
*** Optional *** Optional
:PROPERTIES: :PROPERTIES:

View file

@ -151,11 +151,18 @@
./profiles/common/home ./profiles/common/home
]; ];
# For adding things to _module.args (making arguments available globally)
# moduleArgs = [
# {
# _module.args = { inherit self; };
# }
# ];
in in
{ {
inherit lib; inherit lib;
inherit mixedModules; inherit mixedModules;
# inherit moduleArgs;
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home; homeManagerModules = import ./modules/home;
@ -198,46 +205,15 @@
]; ];
}; };
sandbox = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
inputs.disko.nixosModules.disko
./profiles/sandbox/disk-config.nix
inputs.sops-nix.nixosModules.sops
./profiles/sandbox/nixos.nix
];
};
threed = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = nixModules ++ [
inputs.lanzaboote.nixosModules.lanzaboote
./profiles/threed/nixos.nix
inputs.home-manager.nixosModules.home-manager
{
home-manager.users.swarsel.imports = mixedModules ++ [
./profiles/threed/home.nix
];
}
];
};
fourside = lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = nixModules ++ [
./profiles/fourside
];
};
nbl-imba-2 = lib.nixosSystem { nbl-imba-2 = lib.nixosSystem {
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit self inputs outputs; };
modules = nixModules ++ [ modules = nixModules ++ [
./profiles/nbl-imba-2 ./profiles/nbl-imba-2
]; ];
}; };
winters = lib.nixosSystem { winters = lib.nixosSystem {
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit self inputs outputs; };
modules = [ modules = [
./profiles/server/winters ./profiles/server/winters
]; ];

2099
index.html

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
{ lib, config, ... }: { lib, ... }:
{ {
options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host"; options.swarselsystems.isDarwin = lib.mkEnableOption "darwin host";
} }

View file

@ -24,4 +24,5 @@ in
options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server"; options.swarselsystems.server.restic = lib.mkEnableOption "enable restic backups on server";
options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server"; options.swarselsystems.server.monitoring = lib.mkEnableOption "enable monitoring on server";
options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server"; options.swarselsystems.server.jenkins = lib.mkEnableOption "enable jenkins on server";
options.swarselsystems.server.emacs = lib.mkEnableOption "enable emacs server on server";
} }

View file

@ -1,6 +1,7 @@
{ lib, pkgs, config, ... }: _:
{ {
imports = [ imports = [
./settings.nix
./packages.nix ./packages.nix
./custom-packages.nix ./custom-packages.nix
./sops.nix ./sops.nix
@ -34,28 +35,4 @@
./zellij.nix ./zellij.nix
./tmux.nix ./tmux.nix
]; ];
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
};
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
home = {
username = lib.mkDefault "swarsel";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
keyboard.layout = "us";
sessionVariables = {
FLAKE = "$HOME/.dotfiles";
};
};
} }

View file

@ -1,11 +1,11 @@
{ pkgs, ... }: { self, pkgs, ... }:
{ {
# enable emacs overlay for bleeding edge features # enable emacs overlay for bleeding edge features
# also read init.el file and install use-package packages # also read init.el file and install use-package packages
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = pkgs.emacsWithPackagesFromUsePackage { package = pkgs.emacsWithPackagesFromUsePackage {
config = ../../../programs/emacs/init.el; config = self + /programs/emacs/init.el;
package = pkgs.emacs-pgtk; package = pkgs.emacs-pgtk;
alwaysEnsure = true; alwaysEnsure = true;
alwaysTangle = true; alwaysTangle = true;

View file

@ -1,10 +1,10 @@
{ pkgs, ... }: { self, pkgs, ... }:
{ {
programs.nix-index = programs.nix-index =
let let
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } '' commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
mkdir -p $out/etc/profile.d mkdir -p $out/etc/profile.d
substitute ${../../../scripts/command-not-found.sh} \ substitute ${self + /scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \ $out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \ --replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput --replace @tput@ ${pkgs.ncurses}/bin/tput

View file

@ -0,0 +1,25 @@
{ lib, config, pkgs, ... }:
{
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
};
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
home = {
username = lib.mkDefault "swarsel";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
keyboard.layout = "us";
sessionVariables = {
FLAKE = "$HOME/.dotfiles";
};
};
}

View file

@ -1,31 +1,31 @@
_: { self, ... }:
{ {
home.file = { home.file = {
"init.el" = { "init.el" = {
source = ../../../programs/emacs/init.el; source = self + /programs/emacs/init.el;
target = ".emacs.d/init.el"; target = ".emacs.d/init.el";
}; };
"early-init.el" = { "early-init.el" = {
source = ../../../programs/emacs/early-init.el; source = self + /programs/emacs/early-init.el;
target = ".emacs.d/early-init.el"; target = ".emacs.d/early-init.el";
}; };
# on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually # on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually
".aspell.conf" = { ".aspell.conf" = {
source = ../../../programs/config/.aspell.conf; source = self + /programs/config/.aspell.conf;
target = ".aspell.conf"; target = ".aspell.conf";
}; };
".gitmessage" = { ".gitmessage" = {
source = ../../../programs/git/.gitmessage; source = self + /programs/git/.gitmessage;
target = ".gitmessage"; target = ".gitmessage";
}; };
"swayidle/config" = { "swayidle/config" = {
source = ../../../programs/swayidle/config; source = self + /programs/swayidle/config;
target = ".config/swayidle/config"; target = ".config/swayidle/config";
}; };
}; };
xdg.configFile = { xdg.configFile = {
"tridactyl/tridactylrc".source = ../../../programs/firefox/tridactyl/tridactylrc; "tridactyl/tridactylrc".source = self + /programs/firefox/tridactyl/tridactylrc;
"tridactyl/themes/base16-codeschool.css".source = ../../../programs/firefox/tridactyl/themes/base16-codeschool.css; "tridactyl/themes/base16-codeschool.css".source = self + /programs/firefox/tridactyl/themes/base16-codeschool.css;
}; };
} }

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { self, config, lib, ... }:
{ {
programs.waybar = { programs.waybar = {
@ -259,6 +259,6 @@
}; };
}; };
}; };
style = builtins.readFile ../../../programs/waybar/style.css; style = builtins.readFile (self + /programs/waybar/style.css);
}; };
} }

View file

@ -1,6 +1,7 @@
{ lib, inputs, ... }: _:
{ {
imports = [ imports = [
./settings.nix
./xserver.nix ./xserver.nix
./users.nix ./users.nix
./env.nix ./env.nix
@ -38,35 +39,9 @@
./lid.nix ./lid.nix
]; ];
nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8043" "jitsi-meet-1.0.8043"
"electron-29.4.6" "electron-29.4.6"
]; ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
system.stateVersion = lib.mkDefault "23.05";
} }

View file

@ -226,7 +226,7 @@
proxy = { }; proxy = { };
wifi = { wifi = {
mode = "ap"; mode = "ap";
ssid = "Hotspot-fourside"; ssid = "Hotspot-swarsel";
}; };
wifi-security = { wifi-security = {
group = "ccmp;"; group = "ccmp;";

View file

@ -9,4 +9,5 @@ _:
}; };
security.polkit.enable = true; security.polkit.enable = true;
} }

View file

@ -0,0 +1,31 @@
{ self, lib, inputs, ... }:
{
nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = inputs; # used mainly for inputs.self
};
system.stateVersion = lib.mkDefault "23.05";
}

View file

@ -1,4 +1,7 @@
{ inputs, outputs, config, pkgs, lib, ... }: { self, inputs, outputs, config, pkgs, lib, ... }:
let
profilesPath = "${self}/profiles";
in
{ {
imports = [ imports = [
@ -8,18 +11,18 @@
./hardware-configuration.nix ./hardware-configuration.nix
./disk-config.nix ./disk-config.nix
../optional/nixos/steam.nix "${profilesPath}/optional/nixos/steam.nix"
../optional/nixos/virtualbox.nix "${profilesPath}/optional/nixos/virtualbox.nix"
# ../optional/nixos/vmware.nix # ../optional/nixos/vmware.nix
../optional/nixos/autologin.nix "${profilesPath}/optional/nixos/autologin.nix"
../optional/nixos/nswitch-rcm.nix "${profilesPath}/optional/nixos/nswitch-rcm.nix"
../optional/nixos/work.nix "${profilesPath}/optional/nixos/work.nix"
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
{ {
home-manager.users.swarsel.imports = outputs.mixedModules ++ [ home-manager.users.swarsel.imports = outputs.mixedModules ++ [
../optional/home/gaming.nix "${profilesPath}/optional/home/gaming.nix"
../optional/home/work.nix "${profilesPath}/optional/home/work.nix"
] ++ (builtins.attrValues outputs.homeManagerModules); ] ++ (builtins.attrValues outputs.homeManagerModules);
} }
] ++ (builtins.attrValues outputs.nixosModules); ] ++ (builtins.attrValues outputs.nixosModules);
@ -76,7 +79,7 @@
}; };
swarselsystems = { swarselsystems = {
wallpaper = ../../wallpaper/lenovowp.png; wallpaper = self + /wallpaper/lenovowp.png;
hasBluetooth = true; hasBluetooth = true;
hasFingerprint = true; hasFingerprint = true;
impermanence = false; impermanence = false;

View file

@ -1,4 +1,4 @@
{ inputs, outputs, config, pkgs, lib, ... }: { inputs, outputs, config, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,7 @@
{ inputs, outputs, config, ... }: { self, inputs, outputs, config, ... }:
let
profilesPath = "${self}/profiles";
in
{ {
imports = [ imports = [
@ -6,8 +9,15 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../optional/nixos/autologin.nix "${profilesPath}/optional/nixos/autologin.nix"
../../server/common "${profilesPath}/server/common/nixos"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users.swarsel.imports = [
"${profilesPath}/server/common/home"
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules); ] ++ (builtins.attrValues outputs.nixosModules);
@ -55,6 +65,7 @@
syncthing = true; syncthing = true;
monitoring = true; monitoring = true;
jenkins = false; jenkins = false;
emacs = false;
}; };
}; };

0
scripts/swarselcheck.sh Normal file → Executable file
View file