Almost ready for prime time?

This commit is contained in:
Daniel Flanagan 2023-10-03 14:50:00 -05:00
parent ab4461c26e
commit 3e77b71198
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
8 changed files with 227 additions and 198 deletions

View file

@ -159,21 +159,19 @@
}, },
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs_4"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1695108154, "lastModified": 1696145345,
"narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=", "narHash": "sha256-3dM7I/d4751SLPJah0to1WBlWiyzIiuCEUwJqwBdmr4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "07682fff75d41f18327a871088d20af2710d4744", "rev": "6f9b5b83ad1f470b3d11b8a9fe1d5ef68c7d0e30",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-23.05", "ref": "master",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
@ -195,6 +193,22 @@
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": {
"lastModified": 1696039360,
"narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "32dcb45f66c0487e92db8303a798ebc548cadedc",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1694908564, "lastModified": 1694908564,
"narHash": "sha256-ducA98AuWWJu5oUElIzN24Q22WlO8bOfixGzBgzYdVc=", "narHash": "sha256-ducA98AuWWJu5oUElIzN24Q22WlO8bOfixGzBgzYdVc=",
@ -260,16 +274,16 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1696039360, "lastModified": 1696019113,
"narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -297,7 +311,7 @@
"hardware": "hardware", "hardware": "hardware",
"helix": "helix", "helix": "helix",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
@ -330,7 +344,7 @@
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_5",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1695284550, "lastModified": 1695284550,

View file

@ -1,10 +1,9 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO: avoid my manual workaround of `nix profile install helix#helix --priority 4` # TODO: avoid my manual workaround of `nix profile install helix#helix --priority 4`
helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b"; helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b";
@ -23,7 +22,7 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs-stable,
nixpkgs-unstable, nixpkgs-unstable,
home-manager, home-manager,
... ...
@ -38,15 +37,15 @@
"x86_64-darwin" "x86_64-darwin"
]; ];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs-stable.lib.genAttrs systems;
in { in {
# Your custom packages # Your custom packages
# Acessible through 'nix build', 'nix shell', etc # Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); packages = forAllSystems (system: import ./pkgs nixpkgs-stable.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt' # Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt' # Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); formatter = forAllSystems (system: nixpkgs-unstable.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays # Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;}; overlays = import ./overlays {inherit inputs;};
@ -62,43 +61,41 @@
# NixOS configuration entrypoint # NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname' # Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = let nixosConfigurations = let
mkNixosSystem = system: modules: # mkNixosSystem = system: modules:
nixpkgs.lib.nixosSystem { # nixpkgs-stable.lib.nixosSystem {
system = system;
specialArgs = {
inherit inputs outputs system;
flake = self;
};
modules = [self.nixosModules.common] ++ modules;
};
# mkNixosUnstableSystem = system: modules:
# nixpkgs-unstable.lib.nixosSystem {
# system = system; # system = system;
# specialArgs = { # specialArgs = {
# inherit inputs outputs system; # inherit inputs outputs system;
# flake = self; # flake = self;
# }; # };
# modules = [ self.nixosModules.common ] ++ modules; # modules = [self.nixosModules.common] ++ modules;
# }; # };
mkNixosUnstableSystem = system: modules:
nixpkgs-unstable.lib.nixosSystem {
system = system;
specialArgs = {
inherit inputs outputs system;
flake = self;
};
modules = [ self.nixosModules.common ] ++ modules;
};
in { in {
dragon = mkNixosSystem "x86_64-linux" [./nixos/dragon]; dragon = mkNixosUnstableSystem "x86_64-linux" [./nixos/dragon];
thinker = mkNixosSystem "x86_64-linux" [./nixos/thinker]; thinker = mkNixosUnstableSystem "x86_64-linux" [./nixos/thinker];
}; };
# Standalone home-manager configuration entrypoint # Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname' # Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = let
"daniel@lyte.dev" = home-manager.lib.homeManagerConfiguration { mkHome = system: modules:
pkgs = nixpkgs.legacyPackages.x86_64-linux; home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = {inherit inputs outputs;}; pkgs = nixpkgs-unstable.legacyPackages.${system};
modules = [./home]; extraSpecialArgs = {inherit inputs outputs system;};
}; modules = modules;
"daniel.flanagan@hq.bill.com" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home];
}; };
in {
"daniel" = mkHome "x86_64-linux" [./home ./home/linux.nix];
"daniel.flanagan" = mkHome "aarch64-darwin" [./home];
}; };
# TODO: darwin for work? # TODO: darwin for work?

View file

@ -1,6 +1,8 @@
{ {
pkgs, pkgs,
lib, lib,
system,
inputs,
... ...
}: let }: let
email = "daniel@lyte.dev"; email = "daniel@lyte.dev";
@ -13,12 +15,7 @@ in {
# }; # };
# }; # };
# TODO: fonts? right now I do this: # TODO: fonts? right now they are only handled at the nixos-level (desktop-usage module)
# curl -o ~/Downloads/iosevkalyte.tar.zstd https://files.lyte.dev/iosevkalyte/rel/iosevkalyteterm-16.4.0.tar.zstd
# tar --zstd -xvf ~/Downloads/iosevka.tar.zstd
# mkdir -p ~/.local/share/fonts
# cp -r iosevkalyteterm/ttf/* ~/.local/share/fonts
# TODO: I bet I can declare an iosevka font build, too, instead
# TODO: wallpaper? # TODO: wallpaper?
home = { home = {
@ -27,20 +24,18 @@ in {
stateVersion = "23.11"; stateVersion = "23.11";
packages = [ packages = [
# I use rtx for managing the following programs' versions instead of nix: # I use gawk for my fish prompt
# kubectl, aws
pkgs.rtx
# I need gawk for my fish prompt
pkgs.gawk pkgs.gawk
inputs.helix.packages.${system}.helix
pkgs.nil pkgs.nil
pkgs.nixpkgs-fmt pkgs.alejandra
# TODO: os-specific scripts? macOS versus Linux (arch or nixos? do I need to distinguish at that point?) # TODO: os-specific scripts? macOS versus Linux (arch or nixos? do I need to distinguish at that point?)
(pkgs.buildEnv { (pkgs.buildEnv {
name = "my-scripts-common"; name = "my-scripts-common";
paths = [../scripts/common]; paths = [./scripts/common];
}) })
]; ];
@ -161,7 +156,7 @@ in {
helix = { helix = {
enable = true; enable = true;
package = pkgs.helix; package = inputs.helix.packages.${system}.helix;
languages = { languages = {
language-server = { language-server = {
lexical = { lexical = {
@ -199,8 +194,8 @@ in {
name = "nix"; name = "nix";
auto-format = true; auto-format = true;
formatter = { formatter = {
command = "nixpkgs-fmt"; command = "alejandra";
args = []; args = ["-"];
}; };
} }
{ {
@ -724,8 +719,8 @@ in {
fish = { fish = {
enable = true; enable = true;
# I load long scripts from files for a better editing experience # I load long scripts from files for a better editing experience
shellInit = builtins.readFile ../fish/shellInit.fish; shellInit = builtins.readFile ./fish/shellInit.fish;
interactiveShellInit = builtins.readFile ../fish/interactiveShellInit.fish; interactiveShellInit = builtins.readFile ./fish/interactiveShellInit.fish;
loginShellInit = ""; loginShellInit = "";
functions = { functions = {
# TODO: I think these should be loaded from fish files too for better editor experience? # TODO: I think these should be loaded from fish files too for better editor experience?
@ -808,6 +803,7 @@ in {
eza = { eza = {
enable = true; enable = true;
package = inputs.nixpkgs-unstable.legacyPackages.${system}.eza;
}; };
skim = { skim = {

View file

@ -293,7 +293,7 @@
home.packages = [ home.packages = [
(pkgs.buildEnv { (pkgs.buildEnv {
name = "my-linux-scripts"; name = "my-linux-scripts";
paths = [../scripts/linux]; paths = [./scripts/linux];
}) })
]; ];

View file

@ -2,12 +2,19 @@
config, config,
lib, lib,
inputs, inputs,
# outputs,
system, system,
... ...
}: let }: let
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs-stable.legacyPackages.${system};
unstable-pkgs = inputs.nixpkgs-unstable.legacyPackages.${system}; unstable-pkgs = inputs.nixpkgs-unstable.legacyPackages.${system};
in { in {
imports = [
inputs.home-manager.nixosModules.home-manager
];
hardware.enableRedistributableFirmware = true;
services.journald.extraConfig = "SystemMaxUse=1G"; services.journald.extraConfig = "SystemMaxUse=1G";
environment = { environment = {
@ -18,7 +25,7 @@ in {
MANPAGER = "less"; MANPAGER = "less";
}; };
systemPackages = with pkgs; systemPackages = with unstable-pkgs;
[ [
age age
bat bat
@ -30,11 +37,11 @@ in {
curl curl
dog dog
dua dua
eza
fd fd
file file
gnumake gnumake
gron gron
helix
hexyl hexyl
htop htop
iputils iputils
@ -63,8 +70,11 @@ in {
zellij zellij
zstd zstd
] ]
++ (with unstable-pkgs; [ ++ (with inputs.home-manager.packages.${system}; [
eza home-manager
])
++ (with inputs.helix.packages.${system}; [
helix
]); ]);
}; };

View file

@ -1,4 +1,9 @@
{pkgs, inputs, system, ...}: { {
pkgs,
inputs,
system,
...
}: {
# TODO: add a DE and include either plasma or gnome as a fallback? # TODO: add a DE and include either plasma or gnome as a fallback?
imports = [ imports = [
@ -7,9 +12,11 @@
]; ];
# fonts.packages if unstable? # fonts.packages if unstable?
fonts.fonts = with pkgs; [ fonts.packages = with pkgs;
[
(nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
] ++ (with inputs.nixpkgs-unstable.legacyPackages.${system}; [ ]
++ (with inputs.nixpkgs-unstable.legacyPackages.${system}; [
(iosevka.override { (iosevka.override {
set = "lyteterm"; set = "lyteterm";
privateBuildPlan = '' privateBuildPlan = ''
@ -106,7 +113,7 @@
two = 'curly-neck' two = 'curly-neck'
three = 'two-arcs' three = 'two-arcs'
four = 'semi-open-non-crossing' four = 'semi-open-non-crossing'
five = 'upright-arched' five = 'vertical-upper-left-bar'
six = 'straight-bar' six = 'straight-bar'
seven = 'curly-serifed-crossbar' seven = 'curly-serifed-crossbar'
eight = 'two-circles' eight = 'two-circles'

View file

@ -5,12 +5,14 @@
lib, lib,
config, config,
pkgs, pkgs,
modulesPath,
... ...
}: { }: {
networking.hostName = "dragon"; networking.hostName = "dragon";
imports = imports =
[ [
(modulesPath + "/installer/scan/not-detected.nix")
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
flake.diskoConfigurations.standard flake.diskoConfigurations.standard
] ]
@ -76,7 +78,8 @@
# hardware # hardware
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"];
boot.kernelModules = ["kvm-amd"];
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

View file

@ -20,7 +20,7 @@ ln -s $PWD/pre-commit.bash .git/hooks/pre-commit
## NixOS ## NixOS
```shell_session ```shell_session
nixos-rebuild --flake git+https://git.lyte.dev/lytedev/nix switch nixos-rebuild switch --flake git+https://git.lyte.dev/lytedev/nix
``` ```
## Not NixOS ## Not NixOS
@ -36,8 +36,9 @@ $ home-manager switch --flake git+https://git.lyte.dev/lytedev/nix
## Push NixOS Config ## Push NixOS Config
```bash ```bash
nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#host' \ host=your_host
--target-host root@host --build-host root@host \ nix run nixpkgs#nixos-rebuild -- --flake "git+https://git.lyte.dev/lytedev/nix#$host" \
--target-host "root@$host" --build-host "root@$host" \
switch --show-trace switch --show-trace
``` ```
@ -47,7 +48,8 @@ nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#h
# initialize a delayed reboot by a process you can kill later if things look good # initialize a delayed reboot by a process you can kill later if things look good
# note that the amount of time you give it probably needs to be enough time to both complete the upgrade # note that the amount of time you give it probably needs to be enough time to both complete the upgrade
# _and_ perform whatever testing you need # _and_ perform whatever testing you need
ssh -t root@host "bash -c ' host=your_host
ssh -t "root@$host" "bash -c '
set -m set -m
(sleep 300; reboot;) & (sleep 300; reboot;) &
jobs -p jobs -p
@ -59,8 +61,8 @@ ssh -t root@host "bash -c '
# we will test things and make sure it works first # we will test things and make sure it works first
# if it fails, the reboot we started previously will automatically kick in once the timeout is reached # if it fails, the reboot we started previously will automatically kick in once the timeout is reached
# and the machine will boot to the now-previous iteration # and the machine will boot to the now-previous iteration
nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#host' \ nix run nixpkgs#nixos-rebuild -- --flake "git+https://git.lyte.dev/lytedev/nix#$host" \
--target-host root@host --build-host root@host \ --target-host "root@$host" --build-host "root@$host" \
test --show-trace test --show-trace
# however you like, verify the system is running as expected # however you like, verify the system is running as expected
@ -73,7 +75,7 @@ nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#h
# if we still have ssh access and the machine fails testing, just rollback # if we still have ssh access and the machine fails testing, just rollback
# instead of waiting for the reboot # instead of waiting for the reboot
# TODO: this is not tested yet # TODO: this is not tested yet
ssh root@beefcake nixos-rebuild --rollback switch ssh "root@$host" nixos-rebuild --rollback switch
``` ```
## Provisioning New NixOS Hosts ## Provisioning New NixOS Hosts