mirror of
https://github.com/davegallant/nix-config
synced 2026-01-12 05:44:06 +00:00
Compare commits
4 Commits
52071c17be
...
ae6d5f799d
| Author | SHA1 | Date | |
|---|---|---|---|
| ae6d5f799d | |||
| 4dd0fde56a | |||
| 352d664ecc | |||
| 376c3685b4 |
@@ -4,6 +4,8 @@ This repo stores nix configuration to manage my hosts running [NixOS](https://ni
|
|||||||
|
|
||||||
The configuration is very specific to my own machines and setup, but it may be a useful reference for anyone else learning or experimenting with nix, whether it be on a personal workstation or a server environment.
|
The configuration is very specific to my own machines and setup, but it may be a useful reference for anyone else learning or experimenting with nix, whether it be on a personal workstation or a server environment.
|
||||||
|
|
||||||
|
<img width="1903" height="986" alt="Image" src="https://github.com/user-attachments/assets/6cba837c-2b5e-4f6c-803e-dbbde81a8047" />
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- [NixOS](nixos.org) (Linux)
|
- [NixOS](nixos.org) (Linux)
|
||||||
@@ -43,7 +45,3 @@ To cleanup previous files, run nix garbage collection:
|
|||||||
```sh
|
```sh
|
||||||
just clean
|
just clean
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pre-commit hooks
|
|
||||||
|
|
||||||
Run `nix develop` to install the pre-commit hooks.
|
|
||||||
|
|||||||
80
flake.lock
generated
80
flake.lock
generated
@@ -182,22 +182,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat_2": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1747046372,
|
|
||||||
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
@@ -339,27 +323,6 @@
|
|||||||
"url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941"
|
"url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitignore": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"pre-commit-hooks",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1709087332,
|
|
||||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gnome-shell": {
|
"gnome-shell": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -603,22 +566,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_6": {
|
"nixpkgs_6": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1759417375,
|
|
||||||
"narHash": "sha256-O7eHcgkQXJNygY6AypkF9tFhsoDQjpNEojw3eFs73Ow=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "dc704e6102e76aad573f63b74c742cd96f8f1e6c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_7": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1751211869,
|
"lastModified": 1751211869,
|
||||||
"narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
|
"narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
|
||||||
@@ -634,7 +581,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_8": {
|
"nixpkgs_7": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1743814133,
|
"lastModified": 1743814133,
|
||||||
"narHash": "sha256-drDyYyUmjeYGiHmwB9eOPTQRjmrq3Yz26knwmMPLZFk=",
|
"narHash": "sha256-drDyYyUmjeYGiHmwB9eOPTQRjmrq3Yz26knwmMPLZFk=",
|
||||||
@@ -723,26 +670,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pre-commit-hooks": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat_2",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": "nixpkgs_6"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1762441963,
|
|
||||||
"narHash": "sha256-j+rNQ119ffYUkYt2YYS6rnd6Jh/crMZmbqpkGLXaEt0=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"rev": "8e7576e79b88c16d7ee3bbd112c8d90070832885",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"darwin": "darwin",
|
"darwin": "darwin",
|
||||||
@@ -753,7 +680,6 @@
|
|||||||
"nixpkgs-master": "nixpkgs-master",
|
"nixpkgs-master": "nixpkgs-master",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"nixvim": "nixvim",
|
"nixvim": "nixvim",
|
||||||
"pre-commit-hooks": "pre-commit-hooks",
|
|
||||||
"stylix": "stylix",
|
"stylix": "stylix",
|
||||||
"vpngate": "vpngate"
|
"vpngate": "vpngate"
|
||||||
}
|
}
|
||||||
@@ -767,7 +693,7 @@
|
|||||||
"firefox-gnome-theme": "firefox-gnome-theme",
|
"firefox-gnome-theme": "firefox-gnome-theme",
|
||||||
"flake-parts": "flake-parts_3",
|
"flake-parts": "flake-parts_3",
|
||||||
"gnome-shell": "gnome-shell",
|
"gnome-shell": "gnome-shell",
|
||||||
"nixpkgs": "nixpkgs_7",
|
"nixpkgs": "nixpkgs_6",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"systems": "systems_3",
|
"systems": "systems_3",
|
||||||
"tinted-foot": "tinted-foot",
|
"tinted-foot": "tinted-foot",
|
||||||
@@ -957,7 +883,7 @@
|
|||||||
"vpngate": {
|
"vpngate": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": "nixpkgs_8"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1753748785,
|
"lastModified": 1753748785,
|
||||||
|
|||||||
15
flake.nix
15
flake.nix
@@ -7,7 +7,6 @@
|
|||||||
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
|
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||||
nixos-needsreboot.url = "github:thefossguy/nixos-needsreboot/master";
|
nixos-needsreboot.url = "github:thefossguy/nixos-needsreboot/master";
|
||||||
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
|
|
||||||
darwin = {
|
darwin = {
|
||||||
url = "github:lnl7/nix-darwin/nix-darwin-25.05";
|
url = "github:lnl7/nix-darwin/nix-darwin-25.05";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -46,20 +45,6 @@
|
|||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
checks = forAllSystems (system: {
|
|
||||||
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
|
||||||
src = ./.;
|
|
||||||
hooks = {
|
|
||||||
nixfmt-rfc-style.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
devShells = forAllSystems (system: {
|
|
||||||
default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
||||||
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
let
|
let
|
||||||
unstable = import nixpkgs-unstable {
|
unstable = import nixpkgs-unstable {
|
||||||
|
|||||||
69
home.nix
69
home.nix
@@ -67,7 +67,6 @@ in
|
|||||||
d = "diff";
|
d = "diff";
|
||||||
dc = "diff --cached";
|
dc = "diff --cached";
|
||||||
dcn = "diff --cached --name-only";
|
dcn = "diff --cached --name-only";
|
||||||
ds = "! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'";
|
|
||||||
l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
|
||||||
ms = "merge --squash";
|
ms = "merge --squash";
|
||||||
p = "push origin";
|
p = "push origin";
|
||||||
@@ -126,39 +125,37 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = ''
|
||||||
set fish_greeting # Disable greeting
|
set fish_greeting
|
||||||
|
|
||||||
# environment variables
|
set -x DOCKER_CLI_HINTS false
|
||||||
set -x PAGER less
|
set -x DOCKER_DEFAULT_PLATFORM linux/amd64
|
||||||
set -x EDITOR vim
|
set -x EDITOR vim
|
||||||
set -x DOCKER_CLI_HINTS false
|
set -x NNN_FIFO "$XDG_RUNTIME_DIR/nnn.fifo"
|
||||||
set -x TERM xterm-256color
|
set -x PAGER less
|
||||||
set -x DOCKER_DEFAULT_PLATFORM linux/amd64
|
set -x TERM xterm-256color
|
||||||
set -x NNN_FIFO "$XDG_RUNTIME_DIR/nnn.fifo"
|
|
||||||
|
|
||||||
# PATH
|
set -x PATH $PATH \
|
||||||
set -x PATH $PATH ~/.cargo/bin
|
~/.cargo/bin \
|
||||||
set -x PATH $PATH ~/.local/bin
|
~/.local/bin \
|
||||||
set -x PATH $PATH ~/.npm-packages/bin
|
~/.npm-packages/bin \
|
||||||
set -x PATH $PATH /opt/homebrew/bin
|
/opt/homebrew/bin \
|
||||||
set -x PATH $PATH ~/.krew/bin
|
~/.krew/bin \
|
||||||
set -x PATH $PATH ~/bin
|
~/bin
|
||||||
|
|
||||||
# Go-related environment
|
# golang
|
||||||
set -x GOPATH ~/go
|
set -x GOPATH ~/go
|
||||||
set -x GOBIN $GOPATH/bin
|
set -x GOBIN $GOPATH/bin
|
||||||
set -x PATH $PATH $GOBIN
|
set -x PATH $PATH $GOBIN
|
||||||
|
|
||||||
source $HOME/work.fish
|
source $HOME/work.fish
|
||||||
|
|
||||||
atuin init fish | source
|
atuin init fish | source
|
||||||
helm completion fish | source
|
helm completion fish | source
|
||||||
kubectl completion fish | source
|
kubectl completion fish | source
|
||||||
# '';
|
# '';
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
c = "code";
|
|
||||||
g = "git";
|
g = "git";
|
||||||
gc = "git checkout $(git branch | fzf)";
|
gc = "git checkout $(git branch | fzf)";
|
||||||
gco = "git checkout $(git branch -r | sed -e 's/^ origin\\///' | fzf)";
|
gco = "git checkout $(git branch -r | sed -e 's/^ origin\\///' | fzf)";
|
||||||
@@ -425,16 +422,16 @@ in
|
|||||||
buffer_font_size = lib.mkForce 18;
|
buffer_font_size = lib.mkForce 18;
|
||||||
};
|
};
|
||||||
userKeymaps = [
|
userKeymaps = [
|
||||||
{
|
{
|
||||||
context = "Editor && !menu";
|
context = "Editor && !menu";
|
||||||
bindings = {
|
bindings = {
|
||||||
"ctrl-c" = "editor::Copy";
|
"ctrl-shift-c" = "editor::Copy";
|
||||||
"ctrl-x" = "editor::Cut";
|
"ctrl-shift-x" = "editor::Cut";
|
||||||
"ctrl-v" = "editor::Paste";
|
"ctrl-shift-v" = "editor::Paste";
|
||||||
"ctrl-z" = "editor::Undo";
|
"ctrl-z" = "editor::Undo";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
firefox = {
|
firefox = {
|
||||||
|
|||||||
Reference in New Issue
Block a user