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

View file

@ -1,10 +1,9 @@
{
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";
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/master";
# TODO: avoid my manual workaround of `nix profile install helix#helix --priority 4`
helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b";
@ -23,7 +22,7 @@
outputs = {
self,
nixpkgs,
nixpkgs-stable,
nixpkgs-unstable,
home-manager,
...
@ -38,15 +37,15 @@
"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
forAllSystems = nixpkgs-stable.lib.genAttrs systems;
in {
# Your custom packages
# 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'
# 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
overlays = import ./overlays {inherit inputs;};
@ -62,17 +61,8 @@
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = let
mkNixosSystem = system: modules:
nixpkgs.lib.nixosSystem {
system = system;
specialArgs = {
inherit inputs outputs system;
flake = self;
};
modules = [self.nixosModules.common] ++ modules;
};
# mkNixosUnstableSystem = system: modules:
# nixpkgs-unstable.lib.nixosSystem {
# mkNixosSystem = system: modules:
# nixpkgs-stable.lib.nixosSystem {
# system = system;
# specialArgs = {
# inherit inputs outputs system;
@ -80,25 +70,32 @@
# };
# 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 {
dragon = mkNixosSystem "x86_64-linux" [./nixos/dragon];
thinker = mkNixosSystem "x86_64-linux" [./nixos/thinker];
dragon = mkNixosUnstableSystem "x86_64-linux" [./nixos/dragon];
thinker = mkNixosUnstableSystem "x86_64-linux" [./nixos/thinker];
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"daniel@lyte.dev" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home];
};
"daniel.flanagan@hq.bill.com" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home];
homeConfigurations = let
mkHome = system: modules:
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs-unstable.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs system;};
modules = modules;
};
in {
"daniel" = mkHome "x86_64-linux" [./home ./home/linux.nix];
"daniel.flanagan" = mkHome "aarch64-darwin" [./home];
};
# TODO: darwin for work?

View file

@ -1,6 +1,8 @@
{
pkgs,
lib,
system,
inputs,
...
}: let
email = "daniel@lyte.dev";
@ -13,12 +15,7 @@ in {
# };
# };
# TODO: fonts? right now I do this:
# 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: fonts? right now they are only handled at the nixos-level (desktop-usage module)
# TODO: wallpaper?
home = {
@ -27,20 +24,18 @@ in {
stateVersion = "23.11";
packages = [
# I use rtx for managing the following programs' versions instead of nix:
# kubectl, aws
pkgs.rtx
# I need gawk for my fish prompt
# I use gawk for my fish prompt
pkgs.gawk
inputs.helix.packages.${system}.helix
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?)
(pkgs.buildEnv {
name = "my-scripts-common";
paths = [../scripts/common];
paths = [./scripts/common];
})
];
@ -161,7 +156,7 @@ in {
helix = {
enable = true;
package = pkgs.helix;
package = inputs.helix.packages.${system}.helix;
languages = {
language-server = {
lexical = {
@ -199,8 +194,8 @@ in {
name = "nix";
auto-format = true;
formatter = {
command = "nixpkgs-fmt";
args = [];
command = "alejandra";
args = ["-"];
};
}
{
@ -724,8 +719,8 @@ in {
fish = {
enable = true;
# I load long scripts from files for a better editing experience
shellInit = builtins.readFile ../fish/shellInit.fish;
interactiveShellInit = builtins.readFile ../fish/interactiveShellInit.fish;
shellInit = builtins.readFile ./fish/shellInit.fish;
interactiveShellInit = builtins.readFile ./fish/interactiveShellInit.fish;
loginShellInit = "";
functions = {
# TODO: I think these should be loaded from fish files too for better editor experience?
@ -808,6 +803,7 @@ in {
eza = {
enable = true;
package = inputs.nixpkgs-unstable.legacyPackages.${system}.eza;
};
skim = {

View file

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

View file

@ -2,12 +2,19 @@
config,
lib,
inputs,
# outputs,
system,
...
}: let
pkgs = inputs.nixpkgs.legacyPackages.${system};
pkgs = inputs.nixpkgs-stable.legacyPackages.${system};
unstable-pkgs = inputs.nixpkgs-unstable.legacyPackages.${system};
in {
imports = [
inputs.home-manager.nixosModules.home-manager
];
hardware.enableRedistributableFirmware = true;
services.journald.extraConfig = "SystemMaxUse=1G";
environment = {
@ -18,7 +25,7 @@ in {
MANPAGER = "less";
};
systemPackages = with pkgs;
systemPackages = with unstable-pkgs;
[
age
bat
@ -30,11 +37,11 @@ in {
curl
dog
dua
eza
fd
file
gnumake
gron
helix
hexyl
htop
iputils
@ -63,8 +70,11 @@ in {
zellij
zstd
]
++ (with unstable-pkgs; [
eza
++ (with inputs.home-manager.packages.${system}; [
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?
imports = [
@ -7,9 +12,11 @@
];
# fonts.packages if unstable?
fonts.fonts = with pkgs; [
fonts.packages = with pkgs;
[
(nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
] ++ (with inputs.nixpkgs-unstable.legacyPackages.${system}; [
]
++ (with inputs.nixpkgs-unstable.legacyPackages.${system}; [
(iosevka.override {
set = "lyteterm";
privateBuildPlan = ''
@ -106,7 +113,7 @@
two = 'curly-neck'
three = 'two-arcs'
four = 'semi-open-non-crossing'
five = 'upright-arched'
five = 'vertical-upper-left-bar'
six = 'straight-bar'
seven = 'curly-serifed-crossbar'
eight = 'two-circles'

View file

@ -5,12 +5,14 @@
lib,
config,
pkgs,
modulesPath,
...
}: {
networking.hostName = "dragon";
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
inputs.disko.nixosModules.disko
flake.diskoConfigurations.standard
]
@ -76,7 +78,8 @@
# hardware
boot.loader.efi.canTouchEfiVariables = 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;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

View file

@ -20,7 +20,7 @@ ln -s $PWD/pre-commit.bash .git/hooks/pre-commit
## NixOS
```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
@ -36,8 +36,9 @@ $ home-manager switch --flake git+https://git.lyte.dev/lytedev/nix
## Push NixOS Config
```bash
nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#host' \
--target-host root@host --build-host root@host \
host=your_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
```
@ -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
# 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
ssh -t root@host "bash -c '
host=your_host
ssh -t "root@$host" "bash -c '
set -m
(sleep 300; reboot;) &
jobs -p
@ -59,8 +61,8 @@ ssh -t root@host "bash -c '
# 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
# and the machine will boot to the now-previous iteration
nix run nixpkgs#nixos-rebuild -- --flake 'git+https://git.lyte.dev/lytedev/nix#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" \
test --show-trace
# 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
# instead of waiting for the reboot
# TODO: this is not tested yet
ssh root@beefcake nixos-rebuild --rollback switch
ssh "root@$host" nixos-rebuild --rollback switch
```
## Provisioning New NixOS Hosts