Compare commits

...

114 Commits

Author SHA1 Message Date
Sam afaf3c4697 create xmodmap-arrow config 2024-09-15 10:12:56 +01:00
Sam 16fee36e96 rm xmodmap from xinitrc 2024-09-15 10:02:02 +01:00
Sam e374498aa4 key-remaps to xinitrc and nixvim buffer switch remaps 2024-09-15 09:51:21 +01:00
Sam f7ffba2266 add nvim buffer switch keymap & change dbt models 2024-09-14 20:19:07 +01:00
Sam a8e0ae35da updated postgres 2024-09-09 11:41:10 +01:00
Sam 564d4f6230 update flake and add .scripts to path 2024-08-31 21:29:38 +01:00
Sam 55d96ce54e Merge branch 'master' of git.bitlab21.com:sam/nixos 2024-08-31 10:30:45 +01:00
Sam d86a05d7c3 add qgis, transmission and mpv to home-manager 2024-08-31 10:30:36 +01:00
Sam 5a6dca3b5d nixvim conform add postgres language to sql-formatter 2024-08-31 10:29:45 +01:00
Sam d418d16fa4 nfs homeshare and photos 2024-08-26 21:04:19 +01:00
Sam 9fe49f4d79 added sql-formatter config 2024-08-25 23:27:42 +01:00
Sam 1af24715ff config conform.nvim
- removed sqlfmt and replaced with sql-formatter
2024-08-25 23:22:24 +01:00
Sam 6f5f8867fd configure dbui 2024-08-24 23:32:48 +01:00
Sam c25d56f350 add yazi to home-manager 2024-08-20 13:14:24 +01:00
Sam 3d90deadf9 nixvim spell 2024-08-20 10:19:24 +01:00
Sam f3ad132675 fix issue with clipboard-save 2024-08-15 13:32:04 +01:00
Sam f6b8aeca69 add tmux to home-manager and removed yaml lsp from nixvim 2024-08-03 12:58:38 +01:00
Sam 9f5e92d452 postgres 2024-08-02 22:53:01 +01:00
Sam dd94dea696 Update LSP plugin configuration
- Enable TypeScript server (tsserver)
- Disable SQL server (sqls)
2024-07-29 13:30:35 +01:00
Sam 19f0057503 add comment plugin to nvim 2024-07-27 11:23:14 +01:00
Sam dabff16a37 Add src alias to zshrc 2024-07-27 11:13:19 +01:00
Sam 5fae14f4fc Add nvim language servers for cls and r 2024-07-27 11:12:41 +01:00
Sam c51cb70732 Change dunst border for urgen notifications 2024-07-27 11:12:16 +01:00
Sam c4ac477d6f update sqlfmt 2024-07-21 20:26:56 +01:00
Sam ff300d8542 Updated dwm 2024-07-21 18:23:24 +01:00
Sam e30e731d61 Added shell.nix to nixos config 2024-07-21 18:22:59 +01:00
Sam 07d19c4535 Remaps Alt_l arrow keys using hjkl 2024-07-21 16:23:47 +01:00
Sam 2ec9f2db77 Modify tlp settings 2024-07-21 16:23:35 +01:00
Sam 0e0e2b2ae7 Add back bind_to_address for mpd 2024-07-21 16:21:54 +01:00
Sam b26aceec76 Disabled alpha plugin for nixvim 2024-07-21 14:52:45 +01:00
Sam 06f6aa1ffd MODIFY: updated battery-status script 2024-07-21 14:46:11 +01:00
Sam 3421360317 Import optional/notes for citadel 2024-07-21 14:42:57 +01:00
Sam 154b474868 Moved hm notes to optional 2024-07-21 14:42:22 +01:00
Sam d5f72ee2fd Added dwm scripts for battery-status and notification 2024-07-21 01:03:28 +01:00
Sam 46018fb461 Removed unnecessary sxhkdrc keybindings 2024-07-21 01:02:48 +01:00
Sam 621e97d8f1 Add backlight to citadel 2024-07-20 23:52:08 +01:00
Sam ae64001bc7 Add bluetooth to citadel 2024-07-20 23:51:40 +01:00
Sam 9d287792c6 Add tlp power save service to citadel 2024-07-20 23:51:10 +01:00
Sam c448a8c0cd Add thinkpad modules to citadel 2024-07-20 23:50:33 +01:00
Sam 87f30f8ace Define cursor and use xresources module 2024-07-20 20:23:02 +01:00
Sam a5e41acf63 Use -merge in xrdb 2024-07-20 20:22:41 +01:00
Sam 21bdc107eb Add gtk cursor theme 2024-07-20 20:22:02 +01:00
Sam d56fc29336 MODIFY: Tweak semita scaling 2024-07-20 18:49:27 +01:00
Sam 9788e0d6e2 remove bind_to_address from mpd 2024-07-20 18:18:53 +01:00
Sam bf30739d8b Xserver scaling, input settings 2024-07-20 17:38:49 +01:00
Sam f8f662daf7 Removed unnecessary monitors option in xinitrc 2024-07-20 17:35:31 +01:00
Sam 04782f64f5 Disabled sb-updates script 2024-07-20 17:34:53 +01:00
Sam cf8c449e5e MODIFY: Removed scaling in xresources for citadel and semita 2024-07-20 17:34:37 +01:00
Sam f7e23e39c7 MODIFY: Add deploy_key into sops hosts 2024-07-20 16:14:09 +01:00
Sam 86f27abb2f MODIFY: Firmware configuration for citadel to enable wifi 2024-07-20 16:13:24 +01:00
Sam fa060dba70 Added sam to networkmanager group 2024-07-20 16:12:49 +01:00
Sam f411adbf20 FIX: Renamed sb-battery 2024-07-20 16:12:10 +01:00
Sam 5e0230dcdd Added dmenu-wifi to dwm 2024-07-20 16:11:42 +01:00
Sam 1049ecbd76 Update flake.lock 2024-07-20 16:10:53 +01:00
Sam e3a1143ca5 Add sb-battery to dwm 2024-07-20 14:48:51 +01:00
Sam b991fa4236 Add citadel to flake.nix 2024-07-20 14:48:32 +01:00
Sam 5f672c2665 Fix justfile for new nix-secrets location 2024-07-20 14:48:04 +01:00
Sam 22ce3e08c2 Fix bootstrap script for new nix-secrets location 2024-07-20 14:47:26 +01:00
Sam 5147d02fa9 Update flake.lock secrets 2024-07-20 14:47:08 +01:00
Sam 6fbd5447b8 Update SOPS_FILE path in justfile
- Changed the path of SOPS_FILE in justfile from "../nix-secrets/secrets.yaml" to "~/.local/share/src/nix-secrets/secrets.yaml"
2024-07-20 13:49:01 +01:00
Sam 1743869b07 Add xresources to semita 2024-07-20 12:39:36 +01:00
Sam 0fb3056a4c Add citadel host 2024-07-20 12:38:57 +01:00
Sam 32bf8eca1f Removed xresources from desktop 2024-07-20 12:38:03 +01:00
Sam c9409866b7 enable printing and add network printer 2024-07-19 13:09:20 +01:00
Sam c5da58fc3b Add vimwiki-sync plugin to nixvim 2024-07-19 11:27:05 +01:00
Sam 82b0838f5c Add get-notes in home-manager activation script 2024-07-19 11:26:32 +01:00
Sam 7440a6662f oil.nvim plugin 2024-07-15 21:30:24 +01:00
mrsu 959d734fd1 Merge branch 'master' of git.bitlab21.com:sam/nixos 2024-07-14 21:04:49 +01:00
mrsu 394a24567b removed test hosts fileserver & nixdev 2024-07-14 21:04:36 +01:00
Sam 6472e085c7 add nameservers to semita 2024-07-14 19:51:09 +01:00
Sam 937b53db87 nixvim todo-comments and fixed TODOs in codebase 2024-07-07 18:26:24 +01:00
Sam fb7cf9e280 merge master 2024-07-07 16:48:11 +01:00
Sam efb6128704 deactivate otter.nvim and rm lxd reference 2024-07-07 16:46:39 +01:00
sam 539ac37b8a Merge branch 'master' into docker 2024-07-07 16:25:47 +01:00
Sam 22aa6d3fa4 nvim_ufo fold plugin fix name 2024-07-07 16:24:50 +01:00
sam 8e527473ac Merge branch 'docker' of git.bitlab21.com:sam/nixos into docker 2024-07-07 16:24:00 +01:00
Sam db7bce57e7 Add arion package 2024-07-07 16:23:36 +01:00
Sam 614b9765dd Docker and postgres config 2024-07-07 16:23:36 +01:00
Sam 4b85810128 small fix 2024-07-07 16:23:36 +01:00
Sam a7c8b86b1f Postgres docker configuration 2024-07-07 16:23:36 +01:00
Sam 89ab4e8f9d Modify postgres docker container
- add sops-secrets for admin pwd
- POSTGRES_MULTIPLE_DATABASES as json to specify users and extensions
- initdb docker entrypoint script to create dbs, users and extensions
  from json
2024-07-07 16:23:36 +01:00
Sam 01ad0238a7 Update nix-secrets 2024-07-07 16:23:36 +01:00
Sam 688c2c9bcd Add arion package 2024-07-07 16:23:36 +01:00
Sam b8973040d5 pg init script to configure db on start
- create users & dbs
- setup db permissions
- install extensions
2024-07-07 16:23:36 +01:00
Sam ba9f593bcd pgdata dir and admin_db default database 2024-07-07 16:23:36 +01:00
Sam 3dbe85853e Build postgres using dockerfile
- use dockerfile to install postgis during build
2024-07-07 16:23:36 +01:00
Sam ba19ee9125 Minor fixes 2024-07-07 16:23:36 +01:00
Sam 8173a0dc94 Podman to user groups 2024-07-07 16:23:36 +01:00
Sam 600160bd9a Arion flake input 2024-07-07 16:23:36 +01:00
Sam 5205e606c1 Docker and postgres config 2024-07-07 16:23:36 +01:00
Sam 5b8a1430fe Add postgres btrfs zvol 2024-07-07 16:23:36 +01:00
Sam 8f458590e2 Remove deploy_key from sops 2024-07-07 16:23:36 +01:00
Sam bcea6919fb Update flake secrets 2024-07-07 16:23:36 +01:00
Sam aa8d4ca3ae nvim_ufo fold plugin 2024-07-07 16:23:05 +01:00
Sam 653901f823 Removed precognition config 2024-07-07 15:39:07 +01:00
sam febc33faee Merge branch 'docker' of git.bitlab21.com:sam/nixos into docker 2024-07-07 15:36:51 +01:00
Sam 2f99d05406 small fix 2024-07-07 15:36:34 +01:00
Sam 947ddaca43 Postgres docker configuration 2024-07-07 15:36:34 +01:00
Sam 529fc394ef Modify postgres docker container
- add sops-secrets for admin pwd
- POSTGRES_MULTIPLE_DATABASES as json to specify users and extensions
- initdb docker entrypoint script to create dbs, users and extensions
  from json
2024-07-07 15:36:34 +01:00
Sam 89646a5d6a Update nix-secrets 2024-07-07 15:36:34 +01:00
Sam 804d6bf4d0 Add arion package 2024-07-07 15:36:34 +01:00
Sam 491350bc58 pg init script to configure db on start
- create users & dbs
- setup db permissions
- install extensions
2024-07-07 15:36:34 +01:00
Sam baaaa3e8d6 pgdata dir and admin_db default database 2024-07-07 15:36:34 +01:00
Sam 591a9ce48f Build postgres using dockerfile
- use dockerfile to install postgis during build
2024-07-07 15:36:34 +01:00
Sam 7df7970414 Minor fixes 2024-07-07 15:36:34 +01:00
Sam 052c941e81 Podman to user groups 2024-07-07 15:36:34 +01:00
Sam f7695f4d15 Arion flake input 2024-07-07 15:36:34 +01:00
Sam 52a3b85c8f Docker and postgres config 2024-07-07 15:36:34 +01:00
Sam c9ee7c7e80 Add postgres btrfs zvol 2024-07-07 15:36:34 +01:00
Sam fc2f6f4ca3 Remove deploy_key from sops 2024-07-07 15:36:34 +01:00
Sam 67e3d9dded Update flake secrets 2024-07-07 15:36:34 +01:00
Sam 4fbfbee45b Removed precognition nixvim plugin 2024-07-07 15:35:38 +01:00
Sam b8f85256a7 small fix 2024-07-06 21:17:32 +01:00
Sam 271b5958b8 Postgres docker configuration 2024-07-06 20:53:26 +01:00
57 changed files with 1242 additions and 605 deletions

View File

@ -40,18 +40,17 @@
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717408969,
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
"lastModified": 1722113426,
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
"owner": "numtide",
"repo": "devshell",
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
"type": "github"
},
"original": {
@ -161,11 +160,11 @@
]
},
"locked": {
"lastModified": 1719877454,
"narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=",
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "4e3583423212f9303aa1a6337f8dffb415920e4f",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
@ -174,24 +173,6 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
@ -206,11 +187,11 @@
]
},
"locked": {
"lastModified": 1719259945,
"narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=",
"lastModified": 1724857454,
"narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07",
"rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6",
"type": "github"
},
"original": {
@ -286,11 +267,11 @@
]
},
"locked": {
"lastModified": 1718530513,
"narHash": "sha256-BmO8d0r+BVlwWtMLQEYnwmngqdXIuyFzMwvmTcLMee8=",
"lastModified": 1720042825,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a1fddf0967c33754271761d91a3d921772b30d0e",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"type": "github"
},
"original": {
@ -308,11 +289,11 @@
]
},
"locked": {
"lastModified": 1719827385,
"narHash": "sha256-qs+nU20Sm8czHg3bhGCqiH+8e13BJyRrKONW34g3i50=",
"lastModified": 1720042825,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "391ca6e950c2525b4f853cbe29922452c14eda82",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"type": "github"
},
"original": {
@ -324,11 +305,11 @@
},
"impermanence": {
"locked": {
"lastModified": 1719091691,
"narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=",
"lastModified": 1724489415,
"narHash": "sha256-ey8vhwY/6XCKoh7fyTn3aIQs7WeYSYtLbYEG87VCzX4=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a",
"rev": "c7f5b394397398c023000cf843986ee2571a1fd7",
"type": "github"
},
"original": {
@ -364,11 +345,11 @@
]
},
"locked": {
"lastModified": 1719845423,
"narHash": "sha256-ZLHDmWAsHQQKnmfyhYSHJDlt8Wfjv6SQhl2qek42O7A=",
"lastModified": 1724561770,
"narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ec12b88104d6c117871fad55e931addac4626756",
"rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e",
"type": "github"
},
"original": {
@ -380,11 +361,11 @@
"nix-secrets": {
"flake": false,
"locked": {
"lastModified": 1720263046,
"narHash": "sha256-6tJLK4EtB4IXBO4i6P/Ulf03Bd7GaEezT7AebN3VPHA=",
"lastModified": 1726340825,
"narHash": "sha256-6gv36ea3aAjJH7osZVzVU0GRoJeVR+iwSP9bSaJC+MI=",
"ref": "refs/heads/master",
"rev": "33d677fea187322e503f8a56d9c75ff7e7df057c",
"revCount": 151,
"rev": "73d4d304a201f7db200ffb5955c8a2f521f635a7",
"revCount": 160,
"type": "git",
"url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git"
},
@ -426,27 +407,27 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1719099622,
"narHash": "sha256-YzJECAxFt+U5LPYf/pCwW/e1iUd2PF21WITHY9B/BAs=",
"lastModified": 1721524707,
"narHash": "sha256-5NctRsoE54N86nWd0psae70YSLfrOek3Kv1e8KoXe/0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5e8e3b89adbd0be63192f6e645e0a54080004924",
"rev": "556533a23879fc7e5f98dd2e0b31a6911a213171",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.11",
"ref": "release-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"lastModified": 1724819573,
"narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"rev": "71e91c409d1e654808b2621f28a327acfdad8dc2",
"type": "github"
},
"original": {
@ -458,11 +439,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1719426051,
"narHash": "sha256-yJL9VYQhaRM7xs0M867ZFxwaONB9T2Q4LnGo1WovuR4=",
"lastModified": 1724855419,
"narHash": "sha256-WXHSyOF4nBX0cvHN3DfmEMcLOVdKH6tnMk9FQ8wTNRc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "89c49874fb15f4124bf71ca5f42a04f2ee5825fd",
"rev": "ae2fc9e0e42caaf3f068c1bfdc11c71734125e06",
"type": "github"
},
"original": {
@ -486,11 +467,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1719923896,
"narHash": "sha256-/hfE2x9NbT13d53o9uq6MuMipV19pJUQzpsZIhlvsiM=",
"lastModified": 1724910205,
"narHash": "sha256-eH2yPsTkaGp87rtxATx9d2dGBQUXH3kQPEOTKmaEb0s=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "d384cf656cb1b21d90eee1b007a6ade6f90768f5",
"rev": "d150ce320e4eda99d8865bbd4c74ee8c47a88097",
"type": "github"
},
"original": {
@ -502,11 +483,11 @@
},
"nur": {
"locked": {
"lastModified": 1719596768,
"narHash": "sha256-quSWztqqMxvSJIKddYp1D0GdR7Kg8JjEVCIzMbtBTQ4=",
"lastModified": 1725083573,
"narHash": "sha256-F9WeDQi+U1+y6BDGvW8PYyi9LALbpo4DlpzfZONh5a0=",
"owner": "nix-community",
"repo": "NUR",
"rev": "35e48702118124ec52a071e300f55c78a4b7b338",
"rev": "83ead973ba76b6ecf2d72dff9b60b56749e29518",
"type": "github"
},
"original": {
@ -538,11 +519,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1719268571,
"narHash": "sha256-pcUk2Fg5vPXLUEnFI97qaB8hto/IToRfqskFqsjvjb8=",
"lastModified": 1723501126,
"narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=",
"owner": "mic92",
"repo": "sops-nix",
"rev": "c2ea1186c0cbfa4d06d406ae50f3e4b085ddc9b3",
"rev": "be0eec2d27563590194a9206f551a6f73d52fa34",
"type": "github"
},
"original": {
@ -551,21 +532,6 @@
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
@ -574,11 +540,11 @@
]
},
"locked": {
"lastModified": 1719887753,
"narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=",
"lastModified": 1724833132,
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c",
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5",
"type": "github"
},
"original": {

View File

@ -130,6 +130,16 @@
}
];
};
citadel = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/citadel
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
};
};
}

80
home/citadel.nix Normal file
View File

@ -0,0 +1,80 @@
{config, ...}: {
imports = [
# Import users
./users/sam
./common/core
# Import optional
./common/optional/git.nix
./common/optional/sops.nix
./common/optional/syncthing.nix
./common/optional/desktop/dwm
./common/optional/desktop/common/themes/standard-dark.nix
./common/optional/notes.nix
./common/optional/yazi.nix
];
colorScheme = {
slug = "serene";
name = "Serene";
author = "Bitlab21";
palette = {
base00 = "#1F1F28";
base01 = "#16161D";
base02 = "#223249";
base03 = "#363646";
base04 = "#727169";
base05 = "#DCD7BA";
base06 = "#C8C093";
base07 = "#717C7C";
base08 = "#C34043";
base09 = "#FFA066";
base0A = "#C0A36E";
base0B = "#76946A";
base0C = "#6A9589";
base0D = "#7E9CD8";
base0E = "#957FB8";
base0F = "#D27E99";
};
};
home.file.".Xresources" = {
recursive = true;
text = ''
! st
st.alpha: 0.8
St.font: monospace:pixelsize=31:antialias=true:autohint=true;
St.font2: NotoColorEmoji:pixelsize=24:antialias=true:autohint=true;
! dwm
dwm.borderpx: 6
dwm.font: monospace:size=14
dwm.col_base00: #${config.colorScheme.colors.base00}
dwm.col_base03: #${config.colorScheme.colors.base03}
dwm.col_base04: #${config.colorScheme.colors.base04}
dwm.col_base05: #${config.colorScheme.colors.base05}
dwm.col_base08: #${config.colorScheme.colors.base08}
dwm.col_base0B: #${config.colorScheme.colors.base0B}
! dmenu
dmenu.font: monospace:size=14
dmenu.font2: NotoColorEmoji:pixelsize=44:antialias=true:autohint=true
dmenu.topbar: 1
dmenu.normfgcolor: #${config.colorScheme.colors.base05}
dmenu.normbgcolor: #${config.colorScheme.colors.base03}
dmenu.selfgcolor: #${config.colorScheme.colors.base00}
dmenu.selbgcolor: #${config.colorScheme.colors.base0B}
Nsxiv.window.background: #${config.colorScheme.colors.base03}
Nsxiv.window.foreground: #${config.colorScheme.colors.base05}
Nsxiv.mark.foreground: #${config.colorScheme.colors.base08}
Nsxiv.bar.background: #${config.colorScheme.colors.base00}
Nsxiv.bar.foreground: #${config.colorScheme.colors.base05}
Nsxiv.bar.font: monospace:size=12
'';
};
}

View File

@ -26,6 +26,7 @@
htop
postgresql
libqalculate
tmux
;
};
home.stateVersion = "24.05";

View File

@ -1,5 +1,8 @@
{ inputs, pkgs, ... }:
{
inputs,
pkgs,
...
}: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
./plugins
@ -11,10 +14,18 @@
# Install home packages needed for nixvim
home.packages = [
pkgs.nixpkgs-fmt
pkgs.black
pkgs.yamllint
pkgs.yamlfmt
pkgs.prettierd
pkgs.sqlfmt
pkgs.nodePackages_latest.sql-formatter
pkgs.alejandra
pkgs.shellcheck
pkgs.shellharden
pkgs.shfmt
pkgs.stylua
];
programs.nixvim = {
enable = true;
enableMan = true; # install man pages for nixvim options
@ -42,7 +53,11 @@
let wiki_0.index = 'home'
let wiki_0.syntax = 'markdown'
let wiki_0.ext = '.md'
'';
" ==== dbui
let g:db_ui_hide_schemas = ['pg_catalog', 'pg_toast_temp.*', 'pg_toast']
let g:db_ui_use_nerd_fonts = 1
let g:db_ui_execute_on_save = 0
'';
};
}

View File

@ -2,32 +2,32 @@
programs.nixvim.keymaps = [
# Switching buffers
{
mode = [ "n" ];
action = "<C-W>h";
mode = ["n"];
action = "<C-w>h";
key = "<S-h>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>j";
mode = ["n"];
action = "<C-w>j";
key = "<S-j>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>k";
mode = ["n"];
action = "<C-w>k";
key = "<S-k>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>l";
mode = ["n"];
action = "<C-w>l";
key = "<S-l>";
options = {
silent = true;
@ -36,7 +36,7 @@
# Toggle nvim-tree
{
mode = [ "n" ];
mode = ["n"];
action = "<cmd>NvimTreeFindFileToggle<CR>";
key = "tt";
options = {
@ -46,40 +46,72 @@
# Clear search highlighting
{
mode = [ "n" ];
mode = ["n"];
key = "<space><space>";
action = "<cmd>nohlsearch<CR>";
options = { noremap = true; };
options = {noremap = true;};
}
# Telescope Plugin
{
# find files
mode = [ "n" ];
mode = ["n"];
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = { noremap = true; };
options = {noremap = true;};
}
{
# live grep
mode = [ "n" ];
mode = ["n"];
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = { noremap = true; };
options = {noremap = true;};
}
{
# buffers
mode = [ "n" ];
mode = ["n"];
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = { noremap = true; };
options = {noremap = true;};
}
{
# help tags
mode = [ "n" ];
mode = ["n"];
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = { noremap = true; };
options = {noremap = true;};
}
# paste over selected text without yanking it
{
mode = ["v"];
key = "p";
action = "\"_dP";
options = {noremap = true;};
}
# resize window
{
mode = ["n"];
key = "<Right>";
action = ":vertical resize +1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Left>";
action = ":vertical resize -1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Down>";
action = ":resize -1<CR>";
options = {noremap = true;};
}
{
mode = ["n"];
key = "<Up>";
action = ": resize +1<CR>";
options = {noremap = true;};
}
];
}

View File

@ -31,5 +31,7 @@
ignorecase = true;
smartcase = true;
backspace = "indent,eol,start"; # allow backspace in insert mode
spell = true;
spelllang = "en_gb";
};
}

View File

@ -1,10 +0,0 @@
{
programs.nixvim.plugins = {
alpha = {
enable = true;
iconsEnabled = true;
theme = "dashboard";
};
};
}

View File

@ -0,0 +1,5 @@
{
programs.nixvim.plugins.comment = {
enable = true;
};
}

View File

@ -6,16 +6,39 @@
timeoutMs = 500;
};
notifyOnError = true;
logLevel = "debug";
formattersByFt = {
html = [["prettierd" "prettier"]];
css = [["prettierd" "prettier"]];
javascript = [["prettierd" "prettier"]];
html = ["prettierd"];
css = ["prettierd"];
javascript = ["prettierd"];
python = ["black"];
lua = ["stylua"];
nix = ["alejandra"];
markdown = [["prettierd" "prettier"]];
yaml = ["yamllint" "yamlfmt"];
sql = ["sqlfmt"];
markdown = ["prettierd"];
yaml = ["yamlfmt"];
sql = ["sql-formatter"];
bash = [
"shellcheck"
"shellharden"
"shfmt"
];
};
formatters = {
sql-formatter = {
command = "sql-formatter";
args = "--config ~/.config/sql-formatter/config.json";
};
};
};
home.file.".config/sql-formatter/config.json".text = ''
{
"language": "postgresql",
"tabWidth": 2,
"linesBetweenQueries": 1,
"expressionWidth": 88,
"newlineBeforeSemicolon": true
}
'';
}

View File

@ -1,5 +1,10 @@
{ pkgs, ... }:
{
pkgs,
config,
...
}: let
user = config.home.username;
in {
imports = [
./cmp.nix
./colorizer.nix
@ -13,7 +18,10 @@
./surround.nix
./telescope.nix
./treesitter.nix
./alpha.nix
./fold.nix
./todo-comments.nix
./oil.nix
./comment.nix
];
# Load Plugins that aren't provided as modules by nixvim
@ -24,29 +32,6 @@
pkgs.vimPlugins.vim-dadbod-ui
pkgs.vimPlugins.vim-dadbod-completion
pkgs.vimPlugins.fugitive
(pkgs.vimUtils.buildVimPlugin
{
name = "precognition.nvim";
src = pkgs.fetchFromGitHub {
owner = "tris203";
repo = "precognition.nvim";
rev = "v1.0.0";
sha256 = "sha256-AqWYV/59ugKyOWALOCdycWVm0bZ7qb981xnuw/mAVzM=";
};
})
# (pkgs.vimUtils.buildVimPlugin
# {
# name = "hardtime";
# src = pkgs.fetchFromGitHub {
# owner = "m4xshen";
# repo = "hardtime.nvim ";
# rev = "9a4e24f";
# #sha256 = "sha256-abe9ZGmL7U9rC+LxC3LO5/bOn8lHke1FCKO0V3TZGs0=";
# };
# })
#
(pkgs.vimUtils.buildVimPlugin
{
name = "buffer_manager.nvim";
@ -58,6 +43,16 @@
};
})
(pkgs.vimUtils.buildVimPlugin
{
name = "vimwiki-sync";
src = pkgs.fetchFromGitHub {
owner = "michal-h21";
repo = "vimwiki-sync";
rev = "99eeab3";
sha256 = "sha256-cz0dSFphIbQAI4AOqwIUpDBTuj/3xlOkhSlIVMdgsqM=";
};
})
# Keep vim-devicons as last entry
pkgs.vimPlugins.vim-devicons
@ -66,11 +61,6 @@
-- buffer_manager.nvim
local opts = {noremap = true}
require("precognition").setup(
{
}
)
require("buffer_manager").setup(
{
line_keys = "1234567890",
@ -110,7 +100,28 @@
opts
)
end
-- Setup vimwiki
vim.g.vimwiki_list = {
{
syntax = "markdown",
ext = ".md",
path = "/home/${user}/.local/share/notes",
},
}
-- Format function for conform.nvim
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
'';
}

View File

@ -0,0 +1,31 @@
{
programs.nixvim.plugins.nvim-ufo = {
enable = true;
};
programs.nixvim.extraConfigLua = ''
-- default fold options
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- nvim_ufo options
vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "Open all folds" })
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "Close all folds" })
vim.keymap.set('n', 'zK', function()
local winid = require("ufo").peekFoldedLinesUnderCursor()
if not winid then
vim.lsp.buf.hover()
end
end , { desc = "Peed fold" })
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { 'lsp', 'indent' }
end
})
'';
}

View File

@ -1,15 +1,18 @@
{
programs.nixvim.plugins.lsp = {
programs.nixvim.plugins = {
lsp = {
enable = true;
servers = {
lua-ls = { enable = true; };
nixd = { enable = true; };
bashls = { enable = true; };
pyright = { enable = true; };
html = { enable = true; };
yamlls = { enable = true; };
marksman = { enable = true; };
#sqls = {enable = true;};
lua-ls = {enable = true;};
nixd = {enable = true;};
bashls = {enable = true;};
pyright = {enable = true;};
html = {enable = true;};
marksman = {enable = true;};
ccls = {enable = true;};
cssls = {enable = true;};
r-language-server = {enable = true;};
tsserver = {enable = true;};
};
keymaps = {
lspBuf = {
@ -33,7 +36,7 @@
action = "type_definition";
desc = "Type Definition";
};
K = {
gK = {
action = "hover";
desc = "Hover";
};
@ -48,4 +51,9 @@
};
};
};
# TODO: enable otter.nvim when merged into nixvim stable
# otter = {
# enable = true;
# };
};
}

View File

@ -0,0 +1,5 @@
{
programs.nixvim.plugins.oil = {
enable = true;
};
}

View File

@ -0,0 +1,19 @@
{
programs = {
nixvim = {
plugins.todo-comments = {
enable = true;
};
keymaps = [
{
mode = [ "n" ];
action = "<cmd>TodoTelescope<cr>";
key = "<leader>ft";
options = {
silent = true;
};
}
];
};
};
}

View File

@ -8,6 +8,7 @@
shellAliases = {
ll = "ls -l";
src = "cd ~/.local/share/src";
};
history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history";

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
imports = [
./firefox.nix
./alacritty.nix
@ -14,5 +14,9 @@
pkgs.xfce.thunar
pkgs.kcolorchooser
pkgs.zotero
pkgs.transmission
pkgs.qgis
pkgs.mpv
pkgs.gnome.simple-scan
];
}

View File

@ -1,21 +1,48 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
# Prevent error when enabling gtk https://github.com/nix-community/home-manager/issues/3113
# error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
home.packages = [ pkgs.dconf ];
gtk.enable = true;
home.file = {
".icons/bibata".source = "${pkgs.bibata-cursors}/share/icons/Bibata-Modern-Classic";
};
home.packages = [
pkgs.dconf
];
# Get details about theme package
#cd $(nix build nixpkgs#kanagawa-gtk-theme --print-out-paths --no-link) && nix run nixpkgs#eza -- --tree --level 4
gtk.theme.package = pkgs.kanagawa-gtk-theme;
gtk.theme.name = "Kanagawa-B";
gtk.iconTheme.package = pkgs.kanagawa-icon-theme;
gtk.iconTheme.name = "Kanagawa";
gtk = {
enable = true;
theme = {
name = "Kanagawa-B";
package = pkgs.kanagawa-gtk-theme;
};
iconTheme = {
package = pkgs.gnome.adwaita-icon-theme;
name = "Adwaita";
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
#gtk.theme.package = pkgs.kanagawa-gtk-theme;
# gtk.cursorTheme = {
# name = "Vimix-Cursors";
# package = pkgs.vimix-cursor-theme;
# };
# gtk.theme.name = "Kanagawa-B";
# gtk.iconTheme.package = pkgs.kanagawa-icon-theme;
# gtk.iconTheme.name = "Kanagawa";
qt.enable = true;
qt.platformTheme.name = "gtk";

View File

@ -7,7 +7,6 @@
./xinitrc.nix
./sxhkdrc.nix
./picom.nix
./xresources.nix
./dunst.nix
./music_player.nix
@ -17,9 +16,11 @@
./scripts/sb-volume.nix
./scripts/sb-network-status.nix
./scripts/sb-updates.nix
./scripts/sb-battery.nix
# Notification scripts
./scripts/dunstify-volume-notification.nix
./scripts/dunstify-battery-notification.nix
# Helper scripts
./scripts/emoji-picker.nix
@ -28,6 +29,8 @@
./scripts/get-focused-monitor.nix
./scripts/git-commit-ai.nix
./scripts/aichat-wrapper.nix
./scripts/dmenu-wifi.nix
./scripts/battery-status.nix
];
home.packages = [

View File

@ -30,7 +30,6 @@
#format = ''%I %s %p\n%b'';
format = ''<b>%s:</b>\n%b\n\n%a '';
#TODO dynamic fonts
font = "monospace";
# Options are "left", "center", and "right".
@ -172,7 +171,7 @@
urgency_critical = {
background = "#${config.colorScheme.colors.base08}";
foreground = "#${config.colorScheme.colors.base05}";
frame_color = "#${config.colorScheme.colors.base00}";
frame_color = "#${config.colorScheme.colors.base05}";
timeout = 0;
};
};

View File

@ -1,6 +1,6 @@
{ pkgs, config, ... }:
{
home.file."mus/music_data".source = config.lib.file.mkOutOfStoreSymlink /media/music/music_data;
home.file."mus/music_data".source = config.lib.file.mkOutOfStoreSymlink /media/media/music/music_data;
home.packages = [
pkgs.ffmpeg
@ -39,7 +39,8 @@
format "44100:16:2"
}
bind_to_address "127.0.0.1" '';
bind_to_address "127.0.0.1"
'';
musicDirectory = "~/mus/music_data";
};

View File

@ -0,0 +1,54 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellScriptBin "battery-status" ''
# Get the current power consumption of the laptop battery
power=$(cat /sys/class/power_supply/BAT0/power_now)
power_watts=$(${pkgs.bc}/bin/bc <<< "scale=3; $power / 1000000")
# Get the current battery charge capacity
energy=$(cat /sys/class/power_supply/BAT0/energy_now)
# Get the current battery status (charging or discharging)
battery_status=$(cat /sys/class/power_supply/BAT0/status)
# Calculate the time remaining until the battery is empty or full
if [ "$battery_status" == "Charging" ]; then
# Calculate the time remaining until the battery is full
hours=$(${pkgs.bc}/bin/bc <<< "scale=2; $power / $energy")
hours_int=$(${pkgs.bc}/bin/bc <<< "scale=0; $hours / 1")
minutes=$(${pkgs.bc}/bin/bc <<< "scale=0; 60 * ($hours - $hours_int)/1")
if [ "$hours_int" -gt "0" ]; then
# Show hours and minutes if time remaining is greater than or equal to 1 hour
echo "Full in: $hours_int hours $minutes minutes"
else
# Show minutes if time remaining is less than 1 hour
echo "Full in: $minutes minutes"
fi
elif [ "$battery_status" == "Discharging" ]; then
# Calculate the time remaining until the battery is empty
hours=$(${pkgs.bc}/bin/bc <<< "scale=2; $energy / $power")
hours_int=$(${pkgs.bc}/bin/bc <<< "scale=0; $hours / 1")
minutes=$(${pkgs.bc}/bin/bc <<< "scale=0; 60 * ($hours - $hours_int)/1")
if [ "$hours_int" -gt "0" ]; then
# Show hours and minutes if time remaining is greater than or equal to 1 hour
echo "Empty in: $hours_int hours $minutes minutes"
else
# Show minutes if time remaining is less than 1 hour
echo "Empty in: $minutes minutes"
fi
elif [ "$battery_status" == "Full" ]; then
echo "Battery full"
elif [ "$battery_status" == "Not charging" ]; then
echo "Battery full - not charging"
fi
echo "Power consumption: $power_watts W"
'')
];
}

View File

@ -14,7 +14,7 @@
*image*)
echo "$(${xclip}/bin/xclip -selection clipboard -t TARGETS -o)"
filename=$(${xclip}/bin/xclip -selection clipboard -t image/png -o | ${openssl}/bin/openssl sha1 | cut -b 49-)
file_exists=$(/bin/ls $image_location | grep $filename | sed "s/\..*//")
file_exists=$(ls $image_location | grep $filename | sed "s/\..*//")
[[ $filename != "$file_exists" ]] &&
xclip -selection clipboard -t image/png -o > "$image_location/$filename.png" &&
notify-send -t 5000 "Image Copied" "$image_location/$filename.png"
@ -22,7 +22,7 @@
*UTF8_STRING*)
echo "$(${xclip}/bin/xclip -selection clipboard -t TARGETS -o)"
filename=$(${xclip}/bin/xclip -selection clipboard -t UTF8_STRING -o | ${openssl}/bin/openssl sha1 | cut -b 49-)
file_exists=$(/bin/ls "$text_location" | grep "$filename" | sed "s/\..*//")
file_exists=$(ls "$text_location" | grep "$filename" | sed "s/\..*//")
echo "$filename" "$file_exists"
[[ "$filename" != "$file_exists" ]] &&
xclip -selection clipboard -t UTF8_STRING -o > "$text_location/$filename"

View File

@ -0,0 +1,51 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dmenu-wifi" ''
nmcli dev wifi rescan
ssid_list=$(nmcli -f in-use,bssid,ssid,mode,chan,freq,rate,signal,bars,security dev wifi)
available_connections=$(echo "$ssid_list" | sed '/--.*Infra/d')
connection=$( echo "$available_connections" | dmenu -l 20)
bssid=$(echo "$connection" | sed 's/^.\s*//;s/\s\s.*$//')
ssid=$(echo "$connection" | sed 's/^.\s*[0-9;A-Z;:]*\s\s//;s/\s*Infra\s*[0-9].*$//')
[[ "$connection" = "" ]] && notify-send -t 5000 "Wifi Connect" "Cancelled" && exit 0
[[ $( echo "$connection" | grep "IN-USE" -o) = "IN-USE" ]] && notify-send -t 5000 "Wifi Connect" "Please select valid network" && exit 0
[[ -n "$(echo "$connection" | grep '\*')" ]] && notify-send -t 5000 "Wifi Connect" "Already Connected to: $(echo "$ssid")" && exit 0
notify-send -t 5000 "Network Manager" "Attempting to connect to $ssid..."
nmcli connection modify "$ssid" 802-11-wireless.bssid "$bssid"
nmcli device wifi connect "$bssid"
return_code=$?
if [ $return_code == 4 ];
then
notify-send -t 5000 "Wifi Connect" "Please enter password for '$ssid'..."
prompt="Enter Password for '$ssid'"
pwd=$(echo "" | dmenu -p "$prompt")
nmcli device wifi connect "$bssid" password "$pwd"
return_code=$?
fi
case "$return_code" in
0) notify-send -t 5000 "Wifi Connect" "Successfully connected to: $ssid!"
pkill -RTMIN+12 dwmblocks
exit 0
;;
3) notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Timeout expired?"
pkill -RTMIN+12 dwmblocks
exit 1
;;
4)
notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Possibly wrong password?"
nmcli connection delete id "$ssid"
pkill -RTMIN+12 dwmblocks
exit 1
;;
*) notify-send -t 5000 "Wifi Connect" "Connection to $ssid failed. Error code $?"
echo "Failed. Exiting"
pkill -RTMIN+12 dwmblocks
exit 1
esac
'')
];
}

View File

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellScriptBin "dunstify-battery-notification" ''
msgTag="battery-notify"
${pkgs.dunst}/bin/dunstify -a "batteryNotify" -u critical -i battery-notify -h string:x-dunst-stack-tag:$msgTag "Battery Status" "$(battery-status)" -t 5000
'')
];
}

View File

@ -0,0 +1,37 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-battery" ''
BAT=/sys/class/power_supply/BAT0/capacity
# Exit script if no battery detected
[ ! -f "$BAT" ] && exit
STATUS=$(cat /sys/class/power_supply/BAT0/uevent | grep "POWER_SUPPLY_STATUS" | sed "s/^.*=//")
capacity=$(cat "$BAT")
if [ "$STATUS" == "Charging" ] || [ "$STATUS" == "Not charging" ]; then
echo "[󰂄 $capacity%] "
else
case $capacity in
100) echo "[󰁹 $capacity%] ";;
9[0-9]) echo "[󰂂 $capacity%] ";;
8[0-9]) echo "[󰂁 $capacity%] ";;
7[0-9]) echo "[󰂀 $capacity%] ";;
6[0-9]) echo "[󰁿 $capacity%] ";;
5[0-9]) echo "[󰁾 $capacity%] ";;
4[0-9]) echo "[󰁽 $capacity%] ";;
3[0-9]) echo "[󰁼 $capacity%] ";;
2[0-9]) echo "[󰁻 $capacity%] ";;
1[0-9]) echo "[󰁺 $capacity%] ";;
[6-9]) echo "[󰁺 $capacity%] ";;
[0-5]) echo "[󰂃 $capacity%] ";;
esac
fi
if [[ $capacity -le 20 && $STATUS != "Charging" ]]; then
dunstify-battery-notification
fi
'')
];
}

View File

@ -4,10 +4,10 @@
(writeShellScriptBin "sb-updates" ''
# Gets number of flake inputs that are ready for update
# Checks every 60 minutes
inputs=$(cd /etc/nixos &&
nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update &&
cat /tmp/update | grep -c Update)
printf "[ $inputs] "
# inputs=$(cd /etc/nixos &&
# nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update &&
# cat /tmp/update | grep -c Update)
# printf "[ $inputs] "
'')
];
}

View File

@ -1,5 +1,5 @@
{
# TODO add emoji and dmenu-dict scripts
# TODO: add emoji and dmenu-dict scripts
home.file.".config/sxhkd/sxhkdrc" = {
recursive = true;
text = ''
@ -15,26 +15,14 @@
XF86AudioMicMute
pamixer --default-source --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86MonBrightnessUp
light -A 5 && dunstify-brightness-notification
XF86MonBrightnessDown
light -U 5 && dunstify-brightness-notification
XF86Messenger
dunstify-battery-notification
control + Home
bookmark-add
control + Insert
bookmark-insert
control + F8
clipboard-image-recall /tmp/clipboard/images/
Print
flameshot gui
env QT_AUTO_SCREEN_SCALE_FACTOR=1.5 QT_SCREEN_SCALE_FACTORS="" flameshot gui
control + F7
emoji-picker

View File

@ -1,18 +1,11 @@
{ config, ... }:
let
monitor = "${toString (builtins.map (m: "xrandr --output ${ m.name } --mode ${ toString( m.width )}x${ toString( m.height )} --pos ${ toString( m.x)}x${ toString( m.y)}" ) config.monitors)}";
in
{
# TODO configure x11 to look in .config/x11
{pkgs, ...}: {
# TODO: configure x11 to look in .config/x11
home.file.".xinitrc" = {
recursive = true;
text = ''
picom -b --config ~/.config/picom/picom.conf
xrdb ~/.Xresources
${monitor}
xrdb -merge ~/.Xresources
autostart="clipboard-save dwmblocks feh-wallpaper-changer sxhkd"

View File

@ -1,44 +0,0 @@
{ config, ... }:
{
home.file.".Xresources" = {
recursive = true;
text = ''
! scale
Xft.dpi: 144
! st
st.alpha: 0.8
St.font: monospace:pixelsize=21:antialias=true:autohint=true;
St.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true;
! dwm
dwm.borderpx: 3
dwm.font: monospace:size=12
dwm.col_base00: #${config.colorScheme.colors.base00}
dwm.col_base03: #${config.colorScheme.colors.base03}
dwm.col_base04: #${config.colorScheme.colors.base04}
dwm.col_base05: #${config.colorScheme.colors.base05}
dwm.col_base08: #${config.colorScheme.colors.base08}
dwm.col_base0B: #${config.colorScheme.colors.base0B}
! dmenu
dmenu.font: monospace:size=12
dmenu.font2: NotoColorEmoji:pixelsize=22:antialias=true:autohint=true
dmenu.topbar: 1
dmenu.normfgcolor: #${config.colorScheme.colors.base05}
dmenu.normbgcolor: #${config.colorScheme.colors.base03}
dmenu.selfgcolor: #${config.colorScheme.colors.base00}
dmenu.selbgcolor: #${config.colorScheme.colors.base0B}
Nsxiv.window.background: #${config.colorScheme.colors.base03}
Nsxiv.window.foreground: #${config.colorScheme.colors.base05}
Nsxiv.mark.foreground: #${config.colorScheme.colors.base08}
Nsxiv.bar.background: #${config.colorScheme.colors.base00}
Nsxiv.bar.foreground: #${config.colorScheme.colors.base05}
Nsxiv.bar.font: monospace:size=12
'';
};
}

View File

@ -0,0 +1,18 @@
{ pkgs, config, lib, ... }:
let
user = config.home.username;
in
{
home.activation.get-notes = lib.hm.dag.entryAfter [ "installPackages" ] ''
notes_dir=/home/${user}/.local/share/notes
remote=git@git.bitlab21.com:sam/notes
if [ -d "$notes_dir" ];
then
cd "$notes_dir"
[ ! -d .git ] && PATH="${pkgs.git}/bin:${pkgs.openssh}/bin:$PATH" git clone "$remote" "$notes_dir"
else
mkdir -p "$notes_dir" && PATH="${pkgs.git}/bin:${pkgs.openssh}/bin:$PATH" git clone "$remote" "$notes_dir"
fi
exit 0
'';
}

View File

@ -0,0 +1,120 @@
{ pkgs, ... }:
{
programs.yazi = {
enable = true;
package = pkgs.yazi;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
log = {
enabled = true;
};
manager = {
show_hidden = false;
sort_by = "modified";
sort_dir_first = true;
sort_reverse = true;
};
};
theme = {
manager = {
marker_copied = { fg = "#98bb6c"; bg = "#98bb6c"; };
marker_cut = { fg = "#e46876"; bg = "#e46876"; };
marker_marked = { fg = "#957fb8"; bg = "#957fb8"; };
marker_selected = { fg = "#ffa066"; bg = "#ffa066"; };
cwd = { fg = "#e6c384"; };
hovered = { reversed = true; };
preview_hovered = { reversed = true; };
tab_active = { reversed = true; };
tab_inactive = { };
tab_width = 1;
count_copied = { fg = "#1f1f28"; bg = "#98bb6c"; };
count_cut = { fg = "#1f1f28"; bg = "#e46876"; };
count_selected = { fg = "#1f1f28"; bg = "#e6c384"; };
border_symbol = "";
border_style = { fg = "#dcd7ba"; };
};
status = {
separator_open = "";
separator_close = "";
separator_style = { fg = "reset"; bg = "#363646"; };
mode_normal = { fg = "#1f1f28"; bg = "#85a6ea"; bold = true; };
mode_select = { fg = "#1f1f28"; bg = "#957fb8"; bold = true; };
mode_unset = { fg = "#1f1f28"; bg = "#e6c384"; bold = true; };
progress_label = { fg = "#85a6ea"; bg = "#363646"; bold = true; };
progress_normal = { fg = "#363646"; bg = "#1f1f28"; };
progress_error = { fg = "#363646"; bg = "#1f1f28"; };
permissions_t = { fg = "#98bb6c"; };
permissions_r = { fg = "#e6c384"; };
permissions_w = { fg = "#e82424"; };
permissions_x = { fg = "#7aa89f"; };
permissions_s = { fg = "#938aa9"; };
};
select = {
border = { fg = "#7fb4ca"; };
active = { fg = "#938aa9"; bold = true; };
inactive = { };
};
input = {
border = { fg = "#7fb4ca"; };
title = { };
value = { };
selected = { reversed = true; };
};
completion = {
border = { fg = "#7fb4ca"; };
active = { reversed = true; };
inactive = { };
};
tasks = {
border = { fg = "#7fb4ca"; };
title = { };
hovered = { fg = "#938aa9"; };
};
which = {
cols = 2;
separator = " - ";
separator_style = { fg = "#727169"; };
mask = { bg = "#16161d"; };
rest = { fg = "#727169"; };
cand = { fg = "#85a6ea"; };
desc = { fg = "#565666"; };
};
help = {
on = { fg = "#7aa89f"; };
run = { fg = "#938aa9"; };
desc = { };
hovered = { reversed = true; bold = true; };
footer = { fg = "#090618"; bg = "#dcd7ba"; };
};
notify = {
title_info = { fg = "#98bb6c"; };
title_warn = { fg = "#e6c384"; };
title_error = { fg = "#e82424"; };
};
filetype = {
rules = [
{ mime = "image/*"; fg = "#e6c384"; }
{ mime = "{audio,video}/*"; fg = "#957fb8"; }
{ mime = "application/{,g}zip"; fg = "#e46876"; }
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}"; fg = "#e46876"; }
{ mime = "application/{pdf,doc,rtf,vnd.*}"; fg = "#6a9589"; }
{ name = "*"; is = "orphan"; fg = "#e46876"; }
{ name = "*"; is = "exec"; fg = "#957fb8"; }
{ name = "*/"; fg = "#85a6ea"; }
];
};
};
};
}

View File

@ -1,4 +1,7 @@
{ ...
{
pkgs,
config,
...
}: {
imports = [
# Import users
@ -12,28 +15,8 @@
./common/optional/syncthing.nix
./common/optional/desktop/dwm
./common/optional/desktop/common/themes/standard-dark.nix
];
# ------
# | DP-1
# ------
monitors = [
{
name = "DP-1";
width = 2560;
height = 1440;
x = 0;
y = 0;
workspace = "1";
primary = true;
}
{
name = "DP-2";
width = 2560;
height = 1440;
x = 2560;
y = 0;
}
./common/optional/notes.nix
./common/optional/yazi.nix
];
colorScheme = {
@ -60,4 +43,37 @@
};
};
xresources.extraConfig = ''
! st
st.alpha: 0.8
St.font: monospace:pixelsize=21:antialias=true:autohint=true;
St.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true;
! dwm
dwm.borderpx: 3
dwm.font: monospace:size=12
dwm.col_base00: #${config.colorScheme.colors.base00}
dwm.col_base03: #${config.colorScheme.colors.base03}
dwm.col_base04: #${config.colorScheme.colors.base04}
dwm.col_base05: #${config.colorScheme.colors.base05}
dwm.col_base08: #${config.colorScheme.colors.base08}
dwm.col_base0B: #${config.colorScheme.colors.base0B}
! dmenu
dmenu.font: monospace:size=12
dmenu.font2: NotoColorEmoji:pixelsize=22:antialias=true:autohint=true
dmenu.topbar: 1
dmenu.normfgcolor: #${config.colorScheme.colors.base05}
dmenu.normbgcolor: #${config.colorScheme.colors.base03}
dmenu.selfgcolor: #${config.colorScheme.colors.base00}
dmenu.selbgcolor: #${config.colorScheme.colors.base0B}
Nsxiv.window.background: #${config.colorScheme.colors.base03}
Nsxiv.window.foreground: #${config.colorScheme.colors.base05}
Nsxiv.mark.foreground: #${config.colorScheme.colors.base08}
Nsxiv.bar.background: #${config.colorScheme.colors.base00}
Nsxiv.bar.foreground: #${config.colorScheme.colors.base05}
Nsxiv.bar.font: monospace:size=12
'';
}

View File

@ -1,25 +1,22 @@
{ outputs, ... }:
{
{outputs, ...}: {
home.username = "sam";
home.homeDirectory = "/home/sam";
imports = [
] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules?
imports =
[
]
++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules?
programs.ssh = {
enable = true;
matchBlocks = {
"git.bitlab21.com" = {
identitiesOnly = true;
identityFile = [ "~/.ssh/id_ed25519" ];
identityFile = ["~/.ssh/id_ed25519"];
};
};
};
home.sessionPath = [
];
xdg.userDirs = {
enable = true;
createDirectories = true;
@ -39,6 +36,6 @@
READER = "zathura";
IMAGE_VIEWER = "nsxiv";
IMAGE_EDITOR = "drawing";
PATH = "$PATH:$HOME/.scripts";
};
}

117
hosts/citadel/default.nix Normal file
View File

@ -0,0 +1,117 @@
{
inputs,
lib,
pkgs,
config,
...
}: let
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
dev = "/dev/nvme0n1"; # depends on target hardware
encrypted = true; # currrently only applies to btrfs
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
user = "sam";
impermanence = true;
in {
imports = [
# Create users for this host
../common/users/${user}
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
# Impermanence
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
# Import core options
./hardware-configuration.nix
../common/core
# Import optional options
../common/optional/persistence.nix
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/nfs-mounts/photos.nix
../common/optional/printing.nix
../common/optional/backlight.nix
../common/optional/xmodmap-arrow-remaps.nix
];
boot = {
blacklistedKernelModules = ["snd_hda_intel" "snd_soc_skl"];
kernelModules = ["iwlwifi"];
initrd.kernelModules = ["thinkpad-acpi" "acpi-call"];
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
extraModulePackages = [
config.boot.kernelPackages.acpi_call
];
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
services = {
libinput.touchpad.accelSpeed = "0.5";
xserver = {
xkb.options = "caps:swapescape";
dpi = 196;
upscaleDefaultCursor = true;
};
};
environment.variables = {
GDK_SCALE = "2.2";
GDK_DPI_SCALE = "0.8";
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=2.2";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
XCURSOR_SIZE = "64";
};
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "ondemand";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
START_CHARGE_THRESH_BAT0 = 50;
STOP_CHARGE_THRESH_BAT0 = 95;
};
};
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
enableRedistributableFirmware = true;
firmware = [
pkgs.sof-firmware
];
};
networking = {
hostName = "citadel";
networkmanager.enable = true;
enableIPv6 = false;
nameservers = ["10.0.10.60" "8.8.8.8"];
};
services.libinput.enable = true;
}

View File

@ -8,18 +8,11 @@
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9bed98b2-5ee2-4408-a9b1-6d40e9b68135";
fsType = "ext4";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction

View File

@ -21,6 +21,9 @@ in
};
secrets = {
"passwords/root".neededForUsers = true;
"ssh_keys/deploy_key/id_ed25519" = {
path = "/etc/ssh/deploy_key-ssh-ed25519";
};
};
};
}

View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.brightnessctl
];
services.illum.enable = true;
}

View File

@ -1,71 +1,7 @@
{ pkgs, lib, inputs, config, ... }:
let
admin_dbPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."software/postgres/admin_db/password".path;
in
{
sops.secrets = {
"software/postgres/admin_db/password" = { };
};
virtualisation.arion = {
backend = "docker";
projects = {
"db".settings.services."db".service = {
restart = "unless-stopped";
build.context = "/nix/store";
build.dockerfile = builtins.baseNameOf "${pkgs.writeScript "pgDockerfile" ''
FROM postgres:16
# install packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-16-postgis \
jq \
&& rm -rf /var/lib/apt/lists/*
''}";
environment = {
POSTGRES_PASSWORD_FILE = admin_dbPasswordFile;
POSTGRES_USER = "admin";
POSTGRES_DB = "admin_db";
PGDATA = "/var/lib/postgresql/data/pgdata";
POSTGRES_MULTIPLE_DATABASES = ''
[
{
"osm": {
"user": "gis",
"extensions": [
"hstore",
"postgis"
]
},
"bitcoin": {
"user": "satoshi",
"extensions": []
},
"btc_models": {
"user": "dbt",
"extensions": []
},
"dev_btc_models": {
"user": "dbt",
"extensions": []
}
"test": {
"user": "test",
"extensions": [hstore]
}
}
]
'';
};
ports = [ "5432:5432" ];
volumes = [
"/mnt/postgres:/var/lib/postgresql/data"
# Need to mount secret file
"${admin_dbPasswordFile}:${admin_dbPasswordFile}"
# PG init script to parse json specified in POSTGRES_MULTIPLE_DATABASES
# creates databases, users and installs extensions for each database.
"${pkgs.writeScript "init.sh" ''
initScript = pkgs.writeText "init.sh" ''
#!/bin/bash
function create_user_and_database() {
local database=$1
@ -100,7 +36,105 @@ in
create_user_and_database "$db_name" "$user" "$extensions"
done
fi
''}:/docker-entrypoint-initdb.d/init.sh"
'';
pg_hbaConfig = pkgs.writeText "pg_hba.conf" ''
none
'';
pgsqlConfig = pkgs.writeText "postgresql.conf" ''
listen_addresses = '*'
port = 5432
max_connections = 100
shared_buffers = 24GB
work_mem = 1GB
maintenance_work_mem = 10GB
autovacuum_work_mem = 2GB
dynamic_shared_memory_type = posix
wal_level = minimal
checkpoint_timeout = 60min
checkpoint_completion_target = 0.9
max_wal_size = 10GB
min_wal_size = 80MB
max_wal_senders = 0
random_page_cost = 1.0
effective_cache_size = 25GB
jit = off
log_line_prefix = '%m [%p] %q%u@%d '
log_timezone = 'Etc/UTC'
cluster_name = 'postgres-docker'
datestyle = 'iso, dmy'
timezone = 'Etc/UTC'
default_text_search_config = 'pg_catalog.english'
'';
in
{
sops.secrets = {
"software/postgres/admin_db/password" = { };
};
virtualisation.arion = {
backend = "docker";
projects = {
"db".settings.services."db".service = {
restart = "unless-stopped";
build.context = "/nix/store";
build.dockerfile = builtins.baseNameOf "${pkgs.writeText "pgDockerfile" ''
FROM postgres:16
# install packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-16-postgis \
jq \
&& rm -rf /var/lib/apt/lists/*
''}";
command = [ "postgres" "-c" "config_file=/etc/postgresql/postgresql.conf" ];
environment = {
POSTGRES_PASSWORD_FILE = admin_dbPasswordFile;
POSTGRES_USER = "admin";
POSTGRES_DB = "admin_db";
PGDATA = "/var/lib/postgresql/data/pgdata";
POSTGRES_MULTIPLE_DATABASES = ''
[
{
"osm": {
"user": "gis",
"extensions": [
"hstore",
"postgis"
]
},
"bitcoin": {
"user": "satoshi",
"extensions": []
},
"btc_models": {
"user": "dbt",
"extensions": []
},
"dev_btc_models": {
"user": "dbt",
"extensions": []
}
}
]
'';
};
ports = [ "5432:5432" ];
volumes = [
# Mount pgdata to external zfs volume
"/mnt/postgres:/var/lib/postgresql/data"
# Mount config files
# "${pg_hbaConfig}:/var/lib/postgres/data/pgdata/pg_hba.conf"
"${pgsqlConfig}:/etc/postgresql/postgresql.conf"
# Need to mount secret file
"${admin_dbPasswordFile}:${admin_dbPasswordFile}"
# PG init script to parse json specified in POSTGRES_MULTIPLE_DATABASES
# creates databases, users and installs extensions for each database.
"${initScript}:/docker-entrypoint-initdb.d/init.sh"
];
};
};

View File

@ -3,8 +3,8 @@
services = {
libinput.enable = true;
xserver = {
autoRepeatDelay = 250;
autoRepeatInterval = 30;
autoRepeatDelay = 300;
autoRepeatInterval = 15;
enable = true;
xkb.layout = "gb";
displayManager.startx.enable = true;
@ -12,12 +12,11 @@
windowManager.dwm = {
enable = true;
package = pkgs.dwm.overrideAttrs {
src = pkgs.fetchFromGitea {
domain = "git.bitlab21.com";
owner = "sam";
repo = "dwm";
rev = "ee95ad6795dc51217008363e56fe313d1cfdbaf4";
sha256 = "sha256-L+TAv0g9VhvM+O5gpbKoCk5fCsktWzjQCa2JkN0Xjt4=";
#src = /home/sam/.local/share/src/dwm;
src = pkgs.fetchgit {
url = "https://git.bitlab21.com/sam/dwm";
rev = "49dd30c0d9970ce480ada51dfcaac1a071804c64";
sha256 = "0ywca25a1pdjvb4cgv5gx36x3yd6922pqvn9a5f60lcn5fv2a96n";
};
};
};

View File

@ -0,0 +1,9 @@
{
fileSystems."/media/homeshare" = {
device = "10.0.10.30:/mnt/homeshare";
fsType = "nfs";
options = [ "noatime" "_netdev" ];
};
}

View File

@ -0,0 +1,7 @@
{
fileSystems."/media/media" = {
device = "10.0.10.30:/mnt/media";
fsType = "nfs";
options = ["noatime" "_netdev"];
};
}

View File

@ -1,8 +0,0 @@
{
fileSystems."/media/music" = {
device = "10.0.10.30:/mnt/media/music";
fsType = "nfs";
options = [ "noatime" "_netdev" ];
};
}

View File

@ -0,0 +1,9 @@
{
fileSystems."/media/photos" = {
device = "10.0.10.30:/mnt/photos";
fsType = "nfs";
options = [ "noatime" "_netdev" "ro" ];
};
}

View File

@ -0,0 +1,36 @@
{pkgs, ...}: {
services = {
udev.packages = [pkgs.sane-airscan];
printing = {
enable = true;
drivers = [pkgs.gutenprint pkgs.hplip];
};
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
hardware = {
sane = {
enable = true;
extraBackends = [pkgs.sane-airscan];
netConf = "10.0.10.2";
};
printers = {
ensurePrinters = [
{
name = "HP_ENVY_6000";
description = "Network printer hosted on bob";
location = "bob";
deviceUri = "ipp://bob/printers/HP_ENVY_6000_series";
model = "everywhere";
ppdOptions = {
PageSize = "A4";
};
}
];
};
};
}

View File

@ -0,0 +1,12 @@
{pkgs, ...}: let
customLayout = pkgs.writeText "xkb-layout" ''
keycode 64 = Mode_switch
keycode 43 = h H Left H
keycode 44 = j J Down J
keycode 45 = k K Up K
keycode 46 = l L Right L
'';
in {
# Remap Alt_L +[hjkl] to left down up right
services.xserver.displayManager.sessionCommands = "sleep 5 && ${pkgs.xorg.xmodmap}/bin/xmodmap ${customLayout}";
}

View File

@ -1,22 +1,26 @@
{ pkgs, inputs, config, lib, ... }:
let
{
pkgs,
inputs,
config,
lib,
...
}: let
username = "media";
pubKeys = lib.filesystem.listFilesRecursive (../keys);
pubKeys = lib.filesystem.listFilesRecursive ../keys;
hostname = config.networking.hostName;
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/${username}".path;
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
in
{
in {
users.users.${username} = {
isNormalUser = true;
shell = pkgs.zsh; # default shell
hashedPasswordFile = sopsHashedPasswordFile;
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
extraGroups =
[
extraGroups = [
"scanner"
"lp"
"wheel"
];
@ -65,13 +69,11 @@ in
# The containing ssh folders are created as root and if this is the first ~/.ssh/ entry when writing keys,
# the ownership is busted and home-manager can't target because it can't write into .ssh...
# FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed
system.activationScripts.sopsSetSshOwnwership =
let
system.activationScripts.sopsSetSshOwnwership = let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in
''
in ''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
@ -82,7 +84,7 @@ in
programs.fuse.userAllowOther = true;
home-manager = {
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = {inherit inputs;};
users = {
${username} = import ../../../../home/${hostname}.nix;
};

View File

@ -1,13 +1,17 @@
{ pkgs, inputs, config, lib, ... }:
let
{
pkgs,
inputs,
config,
lib,
...
}: let
hostname = config.networking.hostName;
pubKeys = lib.filesystem.listFilesRecursive (../keys);
pubKeys = lib.filesystem.listFilesRecursive ../keys;
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/sam".path;
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
username = "sam";
in
{
in {
users.users.${username} = {
isNormalUser = true;
shell = pkgs.zsh; # default shell
@ -16,8 +20,10 @@ in
extraGroups = [
"wheel"
"networkmanager"
"scanner"
"lp"
];
};
sops.secrets = {
@ -38,18 +44,24 @@ in
"github-access-token" = {
mode = "0655";
};
"software/postgres/btc_models/password" = { };
"software/postgres/btc_models/ip" = { };
"software/postgres/btc_models/username" = { };
"software/zotero/username" = { };
"software/zotero/password" = { };
"software/zotero/guid" = { };
"software/postgres/baseddata_models/password" = {};
"software/postgres/baseddata_models/ip" = {};
"software/postgres/baseddata_models/username" = {};
"software/postgres/osm/password" = {};
"software/postgres/osm/ip" = {};
"software/postgres/osm/username" = {};
"software/postgres/bitcoin/password" = {};
"software/postgres/bitcoin/ip" = {};
"software/postgres/bitcoin/username" = {};
"software/zotero/username" = {};
"software/zotero/password" = {};
"software/zotero/guid" = {};
};
# Setup software specific templates for user
# Should be part of home-manager - waiting for templates functionality
# See here https://github.com/Mic92/sops-nix/issues/423 and here https://github.com/Mic92/sops-nix/issues/498
# TODO migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix
# TODO: migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix
sops.templates."dbui_connections.json" = {
path = "/home/${username}/.local/share/db_ui/connections.json";
owner = "${username}";
@ -57,12 +69,20 @@ in
content = ''
[
{
"url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/btc_models",
"name": "btc_models"
"url": "postgresql://${config.sops.placeholder."software/postgres/baseddata_models/username"}:${config.sops.placeholder."software/postgres/baseddata_models/password"}@${config.sops.placeholder."software/postgres/baseddata_models/ip"}/btc_models",
"name": "baseddata_models"
},
{
"url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/dev_btc_models",
"name": "dev_btc_models"
"url": "postgresql://${config.sops.placeholder."software/postgres/baseddata_models/username"}:${config.sops.placeholder."software/postgres/baseddata_models/password"}@${config.sops.placeholder."software/postgres/baseddata_models/ip"}/dev_baseddata_models",
"name": "dev_baseddata_models"
},
{
"url": "postgresql://${config.sops.placeholder."software/postgres/osm/username"}:${config.sops.placeholder."software/postgres/osm/password"}@${config.sops.placeholder."software/postgres/osm/ip"}/osm",
"name": "osm"
},
{
"url": "postgresql://${config.sops.placeholder."software/postgres/bitcoin/username"}:${config.sops.placeholder."software/postgres/bitcoin/password"}@${config.sops.placeholder."software/postgres/bitcoin/ip"}/bitcoin",
"name": "bitcoin"
}
]
'';
@ -73,27 +93,27 @@ in
owner = "${username}";
mode = "0600";
content = ''
bitcoin:
baseddata:
target: dev
outputs:
dev:
dbname: dev_btc_models
host: ${config.sops.placeholder."software/postgres/btc_models/ip"}
pass: '${config.sops.placeholder."software/postgres/btc_models/password"}'
dbname: dev_baseddata_models
host: ${config.sops.placeholder."software/postgres/baseddata_models/ip"}
pass: '${config.sops.placeholder."software/postgres/baseddata_models/password"}'
port: 5432
schema: models
threads: 6
type: postgres
user: ${config.sops.placeholder."software/postgres/btc_models/username"}
user: ${config.sops.placeholder."software/postgres/baseddata_models/username"}
prod:
dbname: btc_models
host: ${config.sops.placeholder."software/postgres/btc_models/ip"}
pass: '${config.sops.placeholder."software/postgres/btc_models/password"}'
dbname: baseddata_models
host: ${config.sops.placeholder."software/postgres/baseddata_models/ip"}
pass: '${config.sops.placeholder."software/postgres/baseddata_models/password"}'
port: 5432
schema: models
threads: 6
type: postgres
user: ${config.sops.placeholder."software/postgres/btc_models/username"}
user: ${config.sops.placeholder."software/postgres/baseddata_models/username"}
'';
};
@ -107,13 +127,11 @@ in
# The containing folders are created as root and if this is the first entry when writing files,
# the ownership is busted and home-manager can't target because it can't write to these dirs...
# FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed
system.activationScripts.sopsSetOwnwership =
let
system.activationScripts.sopsSetOwnwership = let
sshFolder = "/home/${username}/.ssh";
user = config.users.users.${username}.name;
group = config.users.users.${username}.group;
in
''
in ''
mkdir -p ${sshFolder} || true
chown -R ${user}:${group} /home/${username}/.ssh
'';
@ -127,7 +145,7 @@ in
programs.zsh.enable = true;
home-manager = {
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = {inherit inputs;};
users = {
${username} = import ../../../../home/${hostname}.nix;
};

View File

@ -1,50 +0,0 @@
{ inputs, config, lib, pkgs, outputs, configLib, ... }:
{
imports =
[
# Import core options
./hardware-configuration.nix
../common/core
# Import optional options
../common/optional/openssh
../common/optional/fileserver-nfs-mount.nix
# Create users for this host
../common/users/admin
];
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
config = {
allowUnfree = true;
};
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
networking = {
hostName = "fileserver";
networkmanager.enable = true;
enableIPv6 = false;
hosts = { "192.168.122.223" = [ "fileserver" ]; };
};
time.timeZone = "Europe/London";
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
}

View File

@ -1,34 +0,0 @@
{ inputs, config, lib, pkgs, outputs,... }:
let
dev = "/dev/vda";
in
{
imports =
[
# Import core options
./hardware-configuration.nix
../common/core
# Import optional options
../common/optional/pipewire.nix
../common/optional/hyprland.nix
../common/optional/displayManager/sddm.nix
../common/optional/openssh.nix
# Create users for this host
../common/users/sam
];
boot.loader.grub.enable = true;
boot.loader.grub.device = "${dev}";
networking = {
hostName = "nixdev";
networkmanager.enable = true;
enableIPv6 = false;
};
services.libinput.enable = true;
}

View File

@ -1,33 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f9abe09a-de68-4913-b6c5-ad55b473a961";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/fe24d2ba-2fbc-4ef5-8139-a26f4fc3f3e3"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@ -1,25 +1,38 @@
{ inputs, config, lib, pkgs, outputs, ... }:
let
{
inputs,
lib,
pkgs,
...
}: let
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
dev = "/dev/nvme0n1"; # depends on target hardware
encrypted = true; # currrently only applies to btrfs
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
user = "sam";
impermanence = true;
in
{
imports =
[
in {
imports = [
# Create users for this host
../common/users/${user}
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks { device = dev; impermanence = impermanence; fsType = fsType; encrypted = encrypted; })
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
# Impermanence
(import ../common/disks/btrfs/impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; })
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
# Import core options
./hardware-configuration.nix
@ -30,12 +43,13 @@ in
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/music.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix
];
boot = {
blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ];
blacklistedKernelModules = ["snd_hda_intel" "snd_soc_skl"];
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
loader = {
systemd-boot.enable = true;
@ -44,6 +58,21 @@ in
};
};
services = {
xserver = {
dpi = 144;
upscaleDefaultCursor = true;
};
};
environment.variables = {
GDK_SCALE = "2";
GDK_DPI_SCALE = "0.6";
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=1.8";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
XCURSOR_SIZE = "32";
};
hardware.firmware = [
pkgs.sof-firmware
];
@ -52,6 +81,7 @@ in
hostName = "semita";
networkmanager.enable = true;
enableIPv6 = false;
nameservers = ["10.0.10.60" "8.8.8.8"];
};
services.libinput.enable = true;

View File

@ -27,7 +27,9 @@ in
# Import optional options
../common/optional/openssh.nix
../common/optional/persistence.nix
../common/optional/nfs-mounts/media.nix
../common/optional/gaming.nix
../common/optional/printing.nix
];

View File

@ -1,4 +1,4 @@
SOPS_FILE := "../nix-secrets/secrets.yaml"
SOPS_FILE := "~/.local/share/src/nix-secrets/secrets.yaml"
# default recipe to display help information
default:
@ -26,7 +26,7 @@ edit-sops:
# update keys in secrets.yaml and push to remote
update-sops-secrets:
cd ../nix-secrets && (\
cd ~/.local/share/src/nix-secrets && (\
nix-shell -p sops --run "sops updatekeys -y secrets.yaml" && \
git add -u && (git commit -m "updated secrets" || true) && git push \
)

View File

@ -2,14 +2,17 @@
, fetchurl ? pkgs.fetchurl
, buildPythonPackage ? pkgs.python311Packages.buildPythonPackage
}:
let
version = "0.21.4"; # this needs to be fetched from github to get the latest
in
buildPythonPackage {
pname = "shandy-sqlfmt";
version = "0.21.3";
format = "wheel";
version = version;
src = fetchurl {
url = "https://github.com/tconbeer/sqlfmt/releases/download/v0.21.3/shandy_sqlfmt-0.21.3-py3-none-any.whl";
sha256 = "sha256-gb/gLAcGD7F/0LL6WllfX1CW4Tug//jNDA0v9O5tedA=";
url = "https://github.com/tconbeer/sqlfmt/releases/download/v${version}/shandy_sqlfmt-${version}-py3-none-any.whl";
sha256 = "sha256-mS8afZtQxN/blaVgG2cBD/wnRZGxAwQWPJqtTji1IJk=";
};
doCheck = false;

View File

@ -45,7 +45,7 @@ echo "Creating '$hostname' ssh keys"
ssh-keygen -t ed25519 -f "$temp$persist/etc/ssh/ssh_host_ed25519_key" -C root@"$hostname" -N ""
# Extract luks key from secrets
luks_secret=$(nix-shell -p sops --run "SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt sops -d --extract '[""\"luks_passphrase""\"][""\"$hostname""\"]' ../nix-secrets/secrets.yaml")
luks_secret=$(nix-shell -p sops --run "SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt sops -d --extract '[""\"luks_passphrase""\"][""\"$hostname""\"]' ~/.local/share/src/nix-secrets/secrets.yaml")
echo "$luks_secret" > /tmp/luks_secret.key
# Generate age key from target host and user public ssh key
@ -54,7 +54,7 @@ HOST_AGE_KEY=$(nix-shell -p ssh-to-age --run "cat $temp$persist/etc/ssh/ssh_host
echo -e "Host age key:\n$HOST_AGE_KEY\n"
# Update .sops.yaml with new age key:
SOPS_FILE="../nix-secrets/.sops.yaml"
SOPS_FILE="$HOME/.local/share/src/nix-secrets/.sops.yaml"
sed -i "{
# Remove any * and & entries for this host
/[*&]$hostname/ d;
@ -63,13 +63,14 @@ sed -i "{
/age:/{n; p; s/\(.*- \*\).*/\1$hostname/};
# Inject a new hosts: entry
/&hosts:/{n; p; s/\(.*- &\).*/\1$hostname $HOST_AGE_KEY/}
}" $SOPS_FILE
}" "$SOPS_FILE"
# Commit and push changes to sops file
just update-sops-secrets && just update-flake-secrets && just update-flake
# Copy current nix config over to target
cp -prv . "$temp$persist/etc/nixos"
echo "copying current nix config to host"
cp -pr . "$temp$persist/etc/nixos"
# Install Nixos to target
SHELL=/bin/sh nix run github:nix-community/nixos-anywhere/1.3.0 -- --extra-files "$temp" --disk-encryption-keys /tmp/luks_secret.key /tmp/luks_secret.key --flake .#"$config" root@"$ip" -i "$HOME/.ssh/id_ed25519"

8
shell.nix Normal file
View File

@ -0,0 +1,8 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell
{
nativeBuildInputs = with pkgs; [
update-nix-fetchgit
];
}