diff --git a/SwarselSystems.org b/SwarselSystems.org index a345bb3..29b4fcf 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -1149,41 +1149,37 @@ 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 - { inputs, outputs, config, ... }: + { self, inputs, outputs, ... }: + let + profilesPath = "${self}/profiles"; + in { - imports = [ + "${profilesPath}/darwin/common/nixos" + inputs.home-manager.darwinModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; home-manager.users."leon.schwarzaeugl".imports = [ + "${profilesPath}/darwin/common/home" ] ++ (builtins.attrValues outputs.homeManagerModules); } ] ++ (builtins.attrValues outputs.nixosModules); - nix.settings.experimental-features = "nix-command flakes"; - nixpkgs = { - hostPlatform = "x86_64-darwin"; - inherit (outputs) overlays; - config = { - allowUnfree = true; - }; - }; # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; services.karabiner-elements.enable = true; - home-manager.users."leon.schwarzaeugl".home.stateVersion = "23.05"; - home-manager.users."leon.schwarzaeugl".swarselsystems = { - isDarwin = true; - isLaptop = true; - isNixos = false; - isBtrfs = false; + home-manager.users."leon.schwarzaeugl".home = { + username = lib.mkForce "leon.schwarzaeugl"; + swarselsystems = { + isDarwin = true; + isLaptop = true; + isNixos = false; + isBtrfs = false; + }; }; - system.stateVersion = 4; } #+end_src @@ -2993,6 +2989,7 @@ This section is for setting things that should be used on hosts that are using t { imports = [ ./settings.nix + ./home-manager.nix ./xserver.nix ./users.nix ./env.nix @@ -3041,7 +3038,6 @@ This section is for setting things that should be used on hosts that are using t **** 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). @@ -3070,14 +3066,24 @@ Also, the system state version is set here. No need to touch it. nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; }; + + system.stateVersion = lib.mkDefault "23.05"; + + } + #+end_src + +**** Setup home-manager + +First, we enable the use of =home-manager= as a NixoS modul. + +#+begin_src nix :tangle profiles/common/nixos/home-manager.nix + { inputs, ... }: + { home-manager = { useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = inputs; # used mainly for inputs.self }; - - system.stateVersion = lib.mkDefault "23.05"; - } #+end_src @@ -4526,6 +4532,7 @@ Also, the system state version is set here. No need to touch it. { imports = [ "${profilesPath}/common/nixos/settings.nix" + "${profilesPath}/common/nixos/home-manager.nix" "${profilesPath}/common/nixos/xserver.nix" "${profilesPath}/common/nixos/gc.nix" "${profilesPath}/common/nixos/store.nix" @@ -5989,6 +5996,33 @@ Also, the system state version is set here. No need to touch it. } #+end_src +*** Darwin +**** Imports + +This section sets up all the imports that are used in the home-manager section. + +#+begin_src nix :tangle profiles/darwin/common/nixos/default.nix + { self, ... }: + let + profilesPath = "${self}/profiles"; + in + { + imports = [ + "${profilesPath}/common/nixos/home-manager.nix" + ]; + + nix.settings.experimental-features = "nix-command flakes"; + nixpkgs = { + hostPlatform = "x86_64-darwin"; + inherit (outputs) overlays; + config = { + allowUnfree = true; + }; + }; + + system.stateVersion = 4; + } +#+end_src *** Optional :PROPERTIES: @@ -8905,6 +8939,24 @@ As for the `home.sessionVariables`, it should be noted that environment variable } #+end_src +*** Darwin + +**** Imports + +This section sets up all the imports that are used in the home-manager section. + +#+begin_src nix :tangle profiles/darwin/common/home/default.nix + { self, ... }: + let + profilesPath = "${self}/profiles"; + in + { + imports = [ + "${profilesPath}/common/home/settings.nix" + ]; + } +#+end_src + *** Optional :PROPERTIES: :CUSTOM_ID: h:be623200-557e-4bb7-bb11-1ec5d76c6b8b @@ -9649,7 +9701,7 @@ We set a hook that runs everytime we save the file. It would be a bit more effic (let ((org-confirm-babel-evaluate nil)) ;; (org-html-export-to-html) (org-babel-tangle) - ;; (swarsel/run-formatting) + (swarsel/run-formatting) ))) (setq org-html-htmlize-output-type nil) diff --git a/flake.nix b/flake.nix index 7c7b6ca..b54a791 100644 --- a/flake.nix +++ b/flake.nix @@ -14,96 +14,96 @@ }; inputs = { - + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; - + systems.url = "github:nix-systems/default-linux"; - + # user-level configuration home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - + # overlay to access bleeding edge emacs emacs-overlay = { url = "github:nix-community/emacs-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; - + # nix user repository # i use this mainly to not have to build all firefox extensions # myself as well as for the emacs-init package (tbd) nur.url = "github:nix-community/NUR"; - + # provides GL to non-NixOS hosts nixgl.url = "github:guibou/nixGL"; - + # manages all theming using Home-Manager stylix.url = "github:danth/stylix"; - + # nix secrets management sops-nix.url = "github:Mic92/sops-nix"; - + # enable secure boot on NixOS lanzaboote.url = "github:nix-community/lanzaboote"; - + # nix for android nix-on-droid = { url = "github:nix-community/nix-on-droid/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; - + # generate NixOS images nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs"; }; - + # hardware quirks on nix nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; }; - + # dynamic library loading nix-alien = { url = "github:thiagokokada/nix-alien"; }; - + # automatic nintendo switch payload injection nswitch-rcm-nix = { url = "github:Swarsel/nswitch-rcm-nix"; }; - + # weekly updated nix-index database nix-index-database = { url = "github:nix-community/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; - + disko = { - url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; }; - + impermanence.url = "github:nix-community/impermanence"; - + zjstatus = { url = "github:dj95/zjstatus"; }; - + fw-fanctrl = { url = "github:TamtamHero/fw-fanctrl/packaging/nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - + nix-darwin = { url = "github:lnl7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; - + }; outputs = @@ -118,7 +118,7 @@ let inherit (self) outputs; lib = nixpkgs.lib // home-manager.lib; - + forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); pkgsFor = lib.genAttrs (import systems) ( system: @@ -127,7 +127,7 @@ config.allowUnfree = true; } ); - + # NixOS modules that can only be used on NixOS systems nixModules = [ inputs.stylix.nixosModules.stylix @@ -138,19 +138,19 @@ inputs.nswitch-rcm-nix.nixosModules.nswitch-rcm ./profiles/common/nixos ]; - + # Home-Manager modules wanted on non-NixOS systems homeModules = [ inputs.stylix.homeManagerModules.stylix ]; - + # Home-Manager modules wanted on both NixOS and non-NixOS systems mixedModules = [ inputs.sops-nix.homeManagerModules.sops inputs.nix-index-database.hmModules.nix-index ./profiles/common/home ]; - + # For adding things to _module.args (making arguments available globally) # moduleArgs = [ # { @@ -159,13 +159,13 @@ # ]; in { - + inherit lib; inherit mixedModules; # inherit moduleArgs; nixosModules = import ./modules/nixos; homeManagerModules = import ./modules/home; - + packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); devShells = forEachSystem (pkgs: @@ -185,7 +185,7 @@ inputs.emacs-overlay.overlay inputs.nixgl.overlay ]; - + # NixOS setups - run home-manager as a NixOS module for better compatibility # another benefit - full rebuild on nixos-rebuild switch # run rebuild using `nswitch` @@ -194,8 +194,8 @@ # Make sure to move hardware-configuration to the appropriate location, by default it is found in /etc/nixos/. nixosConfigurations = { - - + + live = lib.nixosSystem { specialArgs = { inherit inputs outputs; }; system = "x86_64-linux"; @@ -204,21 +204,21 @@ ./profiles/live ]; }; - + nbl-imba-2 = lib.nixosSystem { specialArgs = { inherit self inputs outputs; }; modules = nixModules ++ [ ./profiles/nbl-imba-2 ]; }; - + winters = lib.nixosSystem { specialArgs = { inherit self inputs outputs; }; modules = [ ./profiles/server/winters ]; }; - + #ovm swarsel sync = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; @@ -227,7 +227,7 @@ ./profiles/remote/oracle/sync/nixos.nix ]; }; - + #ovm swarsel swatrix = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; @@ -242,37 +242,37 @@ # run rebuild using `hmswitch` homeConfigurations = { - - "swarsel@home-manager" = inputs.home-manager.lib.homeManagerConfiguration { + + "swarsel@home-manager" = inputs.home-manager.lib.homeManagerConfiguration { pkgs = pkgsFor.x86_64-linux; extraSpecialArgs = { inherit inputs outputs; }; - modules = homeModules ++ mixedModules ++ [ - ./profiles/home-manager - ]; - }; - + modules = homeModules ++ mixedModules ++ [ + ./profiles/home-manager + ]; + }; + }; darwinConfigurations = { - + "nbm-imba-166" = inputs.nix-darwin.lib.darwinSystem { - specialArgs = { inherit inputs outputs; }; + specialArgs = { inherit inputs outputs; }; modules = [ ./profiles/nbm-imba-166 ]; }; - + }; nixOnDroidConfigurations = { - + mysticant = inputs.nix-on-droid.lib.nixOnDroidConfiguration { - pkgs = pkgsFor.aarch64-linux; + pkgs = pkgsFor.aarch64-linux; modules = [ ./profiles/mysticant ]; }; - + }; }; diff --git a/index.html b/index.html index a02c5a0..174011a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +-This file has 48987 words spanning 12817 lines and was last revised on 2024-12-05 02:11:17 +0100. +This file has 49106 words spanning 12869 lines and was last revised on 2024-12-05 02:52:40 +0100.
@@ -409,7 +411,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry
-My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-12-05 02:11:17 +0100) +My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-12-05 02:52:40 +0100)
@@ -1156,7 +1158,7 @@ This section mainly exists house different `configuration.nix` files for system{ inputs, outputs, config, pkgs, lib, ... }:
@@ -1539,7 +1541,7 @@ in
{ self, inputs, outputs, config, ... }:
@@ -1620,51 +1622,47 @@ in
{ inputs, outputs, config, ... }:
+{ self, inputs, outputs, ... }:
+let
+ profilesPath = "${self}/profiles";
+in
{
-
imports = [
+ "${profilesPath}/darwin/common/nixos"
+
inputs.home-manager.darwinModules.home-manager
{
- home-manager.useGlobalPkgs = true;
- home-manager.useUserPackages = true;
home-manager.users."leon.schwarzaeugl".imports = [
+ "${profilesPath}/darwin/common/home"
] ++ (builtins.attrValues outputs.homeManagerModules);
}
] ++ (builtins.attrValues outputs.nixosModules);
- nix.settings.experimental-features = "nix-command flakes";
- nixpkgs = {
- hostPlatform = "x86_64-darwin";
- inherit (outputs) overlays;
- config = {
- allowUnfree = true;
- };
- };
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
services.karabiner-elements.enable = true;
- home-manager.users."leon.schwarzaeugl".home.stateVersion = "23.05";
- home-manager.users."leon.schwarzaeugl".swarselsystems = {
- isDarwin = true;
- isLaptop = true;
- isNixos = false;
- isBtrfs = false;
+ home-manager.users."leon.schwarzaeugl".home = {
+ username = lib.mkForce "leon.schwarzaeugl";
+ swarselsystems = {
+ isDarwin = true;
+ isLaptop = true;
+ isNixos = false;
+ isBtrfs = false;
+ };
};
- system.stateVersion = 4;
}
@@ -2913,7 +2911,7 @@ writeShellApplication {
@@ -3121,7 +3119,7 @@ in
{ lib, ... }:
@@ -3437,7 +3435,7 @@ These are some extra options that will be used if the machine also runs NixOS. F
{ lib, ... }:
@@ -3550,7 +3548,7 @@ These are system-level settings specific to NixOS machines. All settings that ar
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. @@ -3561,6 +3559,7 @@ This section is for setting things that should be used on hosts that are using t { imports = [ ./settings.nix + ./home-manager.nix ./xserver.nix ./users.nix ./env.nix @@ -3609,12 +3608,8 @@ This section is for setting things that should be used on hosts that are using t
-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).
{ self, lib, inputs, ... }:
+{ lib, inputs, ... }:
{
nix =
let
@@ -3646,14 +3641,28 @@ Also, the system state version is set here. No need to touch it.
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
+
+ system.stateVersion = lib.mkDefault "23.05";
+
+}
+
+
+First, we enable the use of home-manager as a NixoS modul.
+
{ inputs, ... }:
+{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = inputs; # used mainly for inputs.self
};
-
- system.stateVersion = lib.mkDefault "23.05";
-
}
I am using distrobox to quickly circumvent isses that I cannot immediately solve on NixOS. It is always the goal to quickly get things working on NixOS, but this prevents me from getting completely stuck.
@@ -5161,8 +5170,8 @@ I am using distrobox to quickly circumvent isses that I cannot immediately solveThis turns off the display when the lid is closed.
@@ -5200,12 +5209,12 @@ This turns off the display when the lid is closed.
First, we enable the use of home-manager as a NixoS module.
@@ -5227,6 +5236,7 @@ in
{
imports = [
"${profilesPath}/common/nixos/settings.nix"
+ "${profilesPath}/common/nixos/home-manager.nix"
"${profilesPath}/common/nixos/xserver.nix"
"${profilesPath}/common/nixos/gc.nix"
"${profilesPath}/common/nixos/store.nix"
@@ -5261,7 +5271,7 @@ in
{ lib, config, ... }:
@@ -5282,7 +5292,7 @@ in
{ pkgs, ... }:
@@ -5299,7 +5309,7 @@ in
{ config, ... }:
@@ -5315,7 +5325,7 @@ in
{ pkgs, ... }:
@@ -5371,7 +5381,7 @@ in
{ pkgs, config, ... }:
@@ -5413,7 +5423,7 @@ in
_: @@ -5436,7 +5446,7 @@ in
{ pkgs, lib, config, ... }:
@@ -5485,7 +5495,7 @@ in
{ pkgs, lib, config, ... }:
@@ -5536,7 +5546,7 @@ in
{ pkgs, lib, config, ... }:
@@ -5636,7 +5646,7 @@ in
{ lib, config, ... }:
@@ -5677,7 +5687,7 @@ in
{ pkgs, lib, config, ... }:
@@ -5735,7 +5745,7 @@ in
{ config, lib, pkgs, sops, ... }:
@@ -6060,7 +6070,7 @@ in
{ pkgs, lib, config, ... }:
@@ -6110,7 +6120,7 @@ in
{ lib, config, ... }:
@@ -6166,7 +6176,7 @@ in
{ lib, config, ... }:
@@ -6223,7 +6233,7 @@ in
{ pkgs, lib, config, ... }:
@@ -6363,7 +6373,7 @@ in
{ lib, config, ... }:
@@ -6474,7 +6484,7 @@ in
{ lib, config, ... }:
@@ -6489,7 +6499,7 @@ in
{ lib, config, ... }:
@@ -6656,7 +6666,7 @@ in
{ pkgs, lib, config, ... }:
@@ -6698,7 +6708,7 @@ in
{ lib, config, ... }:
@@ -6736,8 +6746,46 @@ in
+This section sets up all the imports that are used in the home-manager section. +
+ +{ self, ... }:
+let
+ profilesPath = "${self}/profiles";
+in
+{
+ imports = [
+ "${profilesPath}/common/nixos/home-manager.nix"
+ ];
+
+ nix.settings.experimental-features = "nix-command flakes";
+ nixpkgs = {
+ hostPlatform = "x86_64-darwin";
+ inherit (outputs) overlays;
+ config = {
+ allowUnfree = true;
+ };
+ };
+
+ system.stateVersion = 4;
+}
+
+These sets of configuration do not need to be deployed on every host, for a multitude of reasons. @@ -6820,8 +6868,8 @@ This sets the VirtualBox configuration. Guest should not be enabled if not direl
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.
@@ -8167,7 +8215,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
_: @@ -8375,7 +8423,7 @@ Here we set some aliases (some of them should be shellApplications instead) as w
@@ -9476,7 +9524,7 @@ in
"${modifier}+Ctrl+p" = "exec 1password --quick-acces";
"${modifier}+Escape" = "mode $exit";
"${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
- "${modifier}+h" = "exec hyprpicker";
+ "${modifier}+h" = "exec hyprpicker | wl-copy";
"${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
"${modifier}+Shift+s" = "exec slurp | grim -g - Pictures/Screenshots/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')";
"${modifier}+1" = "workspace 1:一";
@@ -9760,12 +9808,12 @@ This service changes the screen hue at night. I am not sure if that really does
This section should be used in order to symlink already existing configuration files using `home.file` and setting session variables using `home.sessionVariables`. @@ -9812,8 +9860,35 @@ As for the `home.sessionVariables`, it should be noted that environment variable
Akin to the optional NixOS modules.
@@ -11076,7 +11151,7 @@ We set a hook that runs everytime we save the file. It would be a bit more effic
(let ((org-confirm-babel-evaluate nil))
;; (org-html-export-to-html)
(org-babel-tangle)
- ;; (swarsel/run-formatting)
+ (swarsel/run-formatting)
)))
(setq org-html-htmlize-output-type nil)
@@ -11259,7 +11334,7 @@ This formats the org code block at point in accordance to the
@@ -11631,8 +11706,8 @@ When Emacs compiles stuff, it often shows a bunch of warnings that I do not need
(setq garbage-collection-messages t) @@ -12877,8 +12952,8 @@ This adds a rudimentary nix-mode to Emacs. I have not really tried this out, as
This adds support for Hashicorp Configuration Language. I need this at work. @@ -12895,8 +12970,8 @@ This adds support for Hashicorp Configuration Language. I need this at work.
This adds support for Groovy, which I specifically need to work with Jenkinsfiles. I need this at work. @@ -12913,8 +12988,8 @@ This adds support for Groovy, which I specifically need to work with Jenkinsfile
This adds support for Dockerfiles. I need this at work. @@ -12929,8 +13004,8 @@ This adds support for Dockerfiles. I need this at work.
This adds support for Terraform configuration files. I need this at work. @@ -13025,8 +13100,8 @@ This mode is not automatically activated anywhere because I only rarely need it.
@@ -13775,8 +13850,8 @@ The following block is mostly inspired from -4.4.32. eglot
++4.4.32. eglot
After having tried out
lsp-modeandlsp-bridgefor a while each, I must say thateglotfeels the most clean and fast to me. @@ -13818,8 +13893,8 @@ After having tried outlsp-modeandlsp-bridgefor a w
This brings back warnings and errors on the sideline for eglot; a feature that I have been missing from lsp-mode for a while.
@@ -14444,8 +14519,8 @@ This sets up the dashboard, which is really quite useless. But, it
@@ -14568,7 +14643,7 @@ Prints a reasuring message to proove good faith."