Compare commits

..

No commits in common. "master" and "development" have entirely different histories.

149 changed files with 1305 additions and 5805 deletions

0
.gitignore vendored
View File

View File

@ -1,56 +1,19 @@
{ {
"nodes": { "nodes": {
"arion": {
"inputs": {
"flake-parts": "flake-parts",
"haskell-flake": "haskell-flake",
"hercules-ci-effects": "hercules-ci-effects",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1720147808,
"narHash": "sha256-hlWEQGUbIwYb+vnd8egzlW/P++yKu3HjV/rOdOPVank=",
"owner": "hercules-ci",
"repo": "arion",
"rev": "236f9dd82d6ef6a2d9987c7a7df3e75f1bc8b318",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "arion",
"rev": "236f9dd82d6ef6a2d9987c7a7df3e75f1bc8b318",
"type": "github"
}
},
"base16-schemes": {
"flake": false,
"locked": {
"lastModified": 1696158499,
"narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=",
"owner": "tinted-theming",
"repo": "base16-schemes",
"rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-schemes",
"type": "github"
}
},
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1728330715, "lastModified": 1713532798,
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -66,45 +29,19 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1715070411, "lastModified": 1716431128,
"narHash": "sha256-5CNvkH0Nf7yMwgKhjUNg/lUK40C7DXB4zKOuA2jVO90=", "narHash": "sha256-t3T8HlX3udO6f4ilLcN+j5eC3m2gqsouzSGiriKK6vk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "4677f6c53482a8b01ee93957e3bdd569d51261d6", "rev": "7ffc4354dfeb37c8c725ae1465f04a9b45ec8606",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "v1.6.1",
"repo": "disko", "repo": "disko",
"type": "github" "type": "github"
} }
}, },
"extra-container": {
"inputs": {
"flake-utils": [
"nix-bitcoin",
"flake-utils"
],
"nixpkgs": [
"nix-bitcoin",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722175938,
"narHash": "sha256-HKyB4HD+NdX3T233bY31hm76v3/tdQBNeLLvopKbZeY=",
"owner": "erikarvstedt",
"repo": "extra-container",
"rev": "37e7207ac9f857eedb58b208b9dc91cd6b24e651",
"type": "github"
},
"original": {
"owner": "erikarvstedt",
"repo": "extra-container",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1696426674,
@ -136,48 +73,6 @@
} }
}, },
"flake-parts": { "flake-parts": {
"inputs": {
"nixpkgs-lib": [
"arion",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"arion",
"hercules-ci-effects",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"flake-parts_3": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"nixvim", "nixvim",
@ -185,11 +80,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1727826117, "lastModified": 1715865404,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -198,16 +93,31 @@
"type": "github" "type": "github"
} }
}, },
"flake-root": {
"locked": {
"lastModified": 1713493429,
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
"owner": "srid",
"repo": "flake-root",
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1726560853, "lastModified": 1701680307,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -216,38 +126,11 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729104314,
"narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
"git-hooks", "pre-commit-hooks",
"nixpkgs" "nixpkgs"
] ]
}, },
@ -265,44 +148,6 @@
"type": "github" "type": "github"
} }
}, },
"haskell-flake": {
"locked": {
"lastModified": 1675296942,
"narHash": "sha256-u1X1sblozi5qYEcLp1hxcyo8FfDHnRUVX3dJ/tW19jY=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "c2cafce9d57bfca41794dc3b99c593155006c71e",
"type": "github"
},
"original": {
"owner": "srid",
"ref": "0.1.0",
"repo": "haskell-flake",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"arion",
"nixpkgs"
]
},
"locked": {
"lastModified": 1719226092,
"narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -310,16 +155,15 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1726989464, "lastModified": 1716736760,
"narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", "narHash": "sha256-h3RmnNknKYtVA+EvUSra6QAwfZjC2q1G8YA7W0gat8Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", "rev": "5d151429e1e79107acf6d06dcc5ace4e642ec239",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-24.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
@ -332,27 +176,26 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1726989464, "lastModified": 1716457508,
"narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", "narHash": "sha256-ZxzffLuWRyuMrkVVq7wastNUqeO0HJL9xqfY1QsYaqo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", "rev": "850cb322046ef1a268449cf1ceda5fd24d930b05",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-24.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"impermanence": { "impermanence": {
"locked": { "locked": {
"lastModified": 1730403150, "lastModified": 1708968331,
"narHash": "sha256-W1FH5aJ/GpRCOA7DXT/sJHFpa5r8sq2qAUncWwRZ3Gg=", "narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "impermanence", "repo": "impermanence",
"rev": "0d09341beeaa2367bac5d718df1404bf2ce45e6f", "rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -361,49 +204,6 @@
"type": "github" "type": "github"
} }
}, },
"nix-bitcoin": {
"inputs": {
"extra-container": "extra-container",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-unstable": "nixpkgs-unstable"
},
"locked": {
"lastModified": 1727247704,
"narHash": "sha256-Jl1CYXNIdJ4Ac0MK15e8+vflFOgPxZZNw24CKfLC6QY=",
"owner": "fort-nix",
"repo": "nix-bitcoin",
"rev": "a0d36d59248ac54f1b42a668326346a77640c7f5",
"type": "github"
},
"original": {
"owner": "fort-nix",
"ref": "nixos-24.05",
"repo": "nix-bitcoin",
"type": "github"
}
},
"nix-colors": {
"inputs": {
"base16-schemes": "base16-schemes",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1707825078,
"narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=",
"owner": "misterio77",
"repo": "nix-colors",
"rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1",
"type": "github"
},
"original": {
"owner": "misterio77",
"repo": "nix-colors",
"type": "github"
}
},
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -412,11 +212,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1729826725, "lastModified": 1716511055,
"narHash": "sha256-w3WNlYxqWYsuzm/jgFPyhncduoDNjot28aC8j39TW0U=", "narHash": "sha256-5Fe/DGgvMhPEMl9VdVxv3zvwRcwNDmW5eRJ0gk72w7U=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "7840909b00fbd5a183008a6eb251ea307fe4a76e", "rev": "0bea8222f6e83247dd13b055d83e64bce02ee532",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -426,12 +226,13 @@
} }
}, },
"nix-secrets": { "nix-secrets": {
"flake": false,
"locked": { "locked": {
"lastModified": 1730130467, "lastModified": 1716755938,
"narHash": "sha256-mcyG1iu8hNmkDjgDEdFQyCZ3bBxBHFKd4nxT8NreMmY=", "narHash": "sha256-x2XbBriM3ZBt6sodNgCvq68gy9lGFanWSGgh8weTB4I=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "c82ff6f7e995503acabb9cf2478e5b4e401968ce", "rev": "b32b7f37f6e4a31b99d1cc4ce2e70778f363e43e",
"revCount": 188, "revCount": 59,
"type": "git", "type": "git",
"url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git"
}, },
@ -442,74 +243,39 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720031269, "lastModified": 0,
"narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", "narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"owner": "NixOS", "path": "/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source",
"repo": "nixpkgs", "type": "path"
"rev": "9f4128e00b0ae8ec65918efeba59db998750ead6",
"type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "id": "nixpkgs",
"ref": "nixos-unstable", "type": "indirect"
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1697935651,
"narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1729973466, "lastModified": 1716655032,
"narHash": "sha256-knnVBGfTCZlQgxY1SgH0vn2OyehH9ykfF8geZgS95bk=", "narHash": "sha256-kQ25DAiCGigsNR/Quxm3v+JGXAEXZ8I7RAF4U94bGzE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cd3e8833d70618c4eea8df06f95b364b016d4950", "rev": "59a450646ec8ee0397f5fa54a08573e8240eb91f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "release-24.05", "ref": "release-23.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1726871744, "lastModified": 1716509168,
"narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable_2": {
"locked": {
"lastModified": 1730200266,
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "rev": "bfb7a882678e518398ce9a31a881538679f6f092",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -519,78 +285,70 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1730481737,
"narHash": "sha256-HaUCfqLIFX/4wiSKkKKSTwUNmZd1EMy+lGB+faadQXU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f18ab3b08f56abc54bcc2ef9bbca627d45926fee",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts",
"git-hooks": "git-hooks", "flake-root": "flake-root",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"pre-commit-hooks": "pre-commit-hooks",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1729945968, "lastModified": 1716746631,
"narHash": "sha256-4u+nbBSMuXWGCtXxUPPEflRm54+y/HLIbhIep9do8Ew=", "narHash": "sha256-0/G9FQaVm321BoCKREwRqr4l93ZwtvW+4x8gjN67bWs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "c05ac01070425ed0797b1ff678dc690c333cea74", "rev": "9697385115fe557468b2ddcbd1277602b3e58d5e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "nixos-24.05",
"repo": "nixvim", "repo": "nixvim",
"type": "github" "type": "github"
} }
}, },
"nur": { "pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1730472538, "lastModified": 1716213921,
"narHash": "sha256-3m4OVGKsbPzMlnS0gVptIZBRlxgqQz+WhfwT+rT823Y=", "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=",
"owner": "nix-community", "owner": "cachix",
"repo": "NUR", "repo": "pre-commit-hooks.nix",
"rev": "52c21ec8fde46366b1a5555e18d854ee18012ac8", "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "cachix",
"repo": "NUR", "repo": "pre-commit-hooks.nix",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"arion": "arion",
"disko": "disko", "disko": "disko",
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",
"nix-bitcoin": "nix-bitcoin",
"nix-colors": "nix-colors",
"nix-secrets": "nix-secrets", "nix-secrets": "nix-secrets",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable_2", "nixpkgs-unstable": "nixpkgs-unstable",
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
}, },
@ -602,11 +360,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1729999681, "lastModified": 1716692524,
"narHash": "sha256-qm0uCtM9bg97LeJTKQ8dqV/FvqRN+ompyW4GIJruLuw=", "narHash": "sha256-sALodaA7Zkp/JD6ehgwc0UCBrSBfB4cX66uFGTsqeFU=",
"owner": "mic92", "owner": "mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "1666d16426abe79af5c47b7c0efa82fd31bf4c56", "rev": "962797a8d7f15ed7033031731d0bb77244839960",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -638,11 +396,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1729613947, "lastModified": 1715940852,
"narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=", "narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "aac86347fb5063960eccb19493e0cadcdb4205ca", "rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
"type": "github" "type": "github"
}, },
"original": { "original": {

118
flake.nix
View File

@ -3,41 +3,26 @@
inputs = { inputs = {
# Nixpkgs # Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# NUR
nur.url = "github:nix-community/NUR";
# Home manager # Home manager
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-24.05"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Nixvim # Nixvim
nixvim = { nixvim = {
url = "github:nix-community/nixvim/nixos-24.05"; url = "github:nix-community/nixvim";
# If you are not running an unstable channel of nixpkgs, select the corresponding branch of nixvim.
# url = "github:nix-community/nixvim/nixos-23.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Arion for docker
arion = {
url = "github:hercules-ci/arion/236f9dd82d6ef6a2d9987c7a7df3e75f1bc8b318";
};
# nix-bitcoin
nix-bitcoin = {
url = "github:fort-nix/nix-bitcoin/nixos-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Nix colors
nix-colors.url = "github:misterio77/nix-colors";
# Declarative partitioning and formatting # Declarative partitioning and formatting
disko = { disko = {
url = "github:nix-community/disko/v1.6.1"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
@ -53,7 +38,7 @@
nix-secrets = { nix-secrets = {
url = "git+ssh://git@git.bitlab21.com/sam/nix-secrets.git"; url = "git+ssh://git@git.bitlab21.com/sam/nix-secrets.git";
inputs = {}; flake = false;
}; };
}; };
@ -61,30 +46,44 @@
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
disko,
#impermanence,
... ...
} @ inputs: let } @ inputs:
let
inherit (self) outputs; inherit (self) outputs;
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
]; ];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
inherit (nixpkgs) lib; specialArgs = { inherit inputs outputs; };
configVars = import ./vars {inherit inputs lib;};
specialArgs = {
inherit
inputs
outputs
configVars
;
};
in { in {
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
overlays = import ./overlays {inherit inputs;}; overlays = import ./overlays {inherit inputs;};
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager; homeManagerModules = import ./modules/home-manager;
# System level configs # System level configs
nixosConfigurations = { nixosConfigurations = {
nixdev = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/nixdev
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
fileserver = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/fileserver
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
bootstrap = nixpkgs.lib.nixosSystem { bootstrap = nixpkgs.lib.nixosSystem {
inherit specialArgs; inherit specialArgs;
modules = [ modules = [
@ -95,42 +94,33 @@
inherit specialArgs; inherit specialArgs;
modules = [ modules = [
./hosts/sparky ./hosts/sparky
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager{
{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
semita = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/semita
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
merlin = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/nebula
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = specialArgs;
}
];
};
citadel = nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
./hosts/citadel
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = specialArgs; home-manager.extraSpecialArgs = specialArgs;
} }
]; ];
}; };
}; };
# # Standalone home-manager configuration entrypoint
# # Available through 'home-manager --flake .#your-username@your-hostname'
# homeConfigurations = {
# # FIXME replace with your username@hostname
# "sam@nixdev" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs outputs ;};
# modules = [
# # > Our main home-manager configuration file <
# ./home/nixdev.nix
# ];
# };
# "admin@fileserver" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs outputs ;};
# modules = [
# # > Our main home-manager configuration file <
# ./home/nixdev.nix
# ];
# };
# };
}; };
} }

View File

@ -1,84 +0,0 @@
{config, pkgs, ...}: {
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
];
home.packages = [
pkgs.qgis
];
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

@ -1,35 +1,11 @@
{ pkgs, inputs, outputs, lib, ... }: { config, lib, pkgs, outputs, ... }:
{ {
imports = [ imports = [
inputs.nix-colors.homeManagerModules.default
./zsh.nix ./zsh.nix
./nixvim ./nixvim.nix
]; ] ;
nixpkgs.overlays = [ home.packages = [
inputs.nur.overlay pkgs.ripgrep
outputs.overlays.additions
outputs.overlays.unstable-packages
]; ];
# Global home packages without config go here (for all hosts and users)
home.packages = builtins.attrValues {
inherit (pkgs)
ripgrep
fzf
eza
bat
killall
pciutils
tree
jq
coreutils
btop
htop
postgresql_16
libqalculate
tmux
;
};
home.stateVersion = "24.05";
} }

356
home/common/core/nixvim.nix Normal file
View File

@ -0,0 +1,356 @@
{ inputs, pkgs, ... }: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
programs.nixvim = {
enable = true;
enableMan = true; # install man pages for nixvim options
clipboard.register = "unnamedplus"; # use system clipboard instead of internal registers
colorschemes.kanagawa = {
enable = true;
settings = {
commentStyle = {
italic = true;
};
dimInactive = true;
terminalColors = true;
theme = "wave";
transparent = false;
undercurl = true;
};
};
opts = {
#
# ========= General Appearance =========
#
background = "";
number = true; # show line numbers
relativenumber = true; # show relative linenumbers
laststatus = 0; # Display status line always
history = 1000; # Store lots of :cmdline history
showcmd = true; # Show incomplete cmds down the bottom
showmode = true; # Show current mode down the bottom
autoread = true; # Reload files changed outside vim
lazyredraw = true; # Redraw only when needed
showmatch = true; # highlight matching braces
ruler = true; # show current line and column
visualbell = true; # No sounds
listchars = "trail:·"; # Display tabs and trailing spaces visually
# ========= Font =========
guifont = "NotoSansMono:h9"; # fontname:fontsize
# ========= Cursor =========
guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,n-v-i:blinkon0";
# ========= Redirect Temp Files =========
# backup
backupdir = "$HOME/.local/state/vim/backup//,/tmp//,.";
writebackup = false;
# swap
directory = "$HOME/.local/vim/swap//,/tmp//,.";
# ================ Indentation ======================
autoindent = true;
cindent = true; # automatically indent braces
smartindent = true;
smarttab = true;
shiftwidth = 2;
softtabstop = 4;
tabstop = 2;
expandtab = true;
# ================ Folds ============================
foldmethod = "indent"; # fold based on indent
foldnestmax = 3; # deepest fold is 3 levels
foldenable = false; # don't fold by default
# ================ Completion =======================
wildmode = "list:longest";
wildmenu = true; # enable ctrl-n and ctrl-p to scroll thru matches
# stuff to ignore when tab completing
wildignore = "*.o,*.obj,*~,vim/backups,sass-cache,DS_Store,vendor/rails/**,vendor/cache/**,*.gem,log/**,tmp/**,*.png,*.jpg,*.gif";
# ================ Scrolling ========================
scrolloff = 4; # Start scrolling when we're 4 lines away from margins
sidescrolloff = 15;
sidescroll = 1;
# ================ Searching ========================
incsearch = true;
hlsearch = true;
ignorecase = true;
smartcase = true;
# ================ Movement ========================
backspace = "indent,eol,start"; # allow backspace in insert mode
};
#
# ========= UI Plugins =========
#
plugins.nvim-colorizer = {
enable = true;
fileTypes = [ "*" ];
};
plugins.lualine = {
enable = true;
theme = "auto";
componentSeparators = {
left = "";
right = "";
};
sectionSeparators = {
left = "";
right = "";
};
sections = {
lualine_a = [ "mode" ];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "filename" ];
lualine_x = [ "encoding" "fileformat" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "locations" ];
};
};
#
# ========= File Search =========
#
plugins.telescope = {
# https://github.com/nvim-telescope/telescope.nvim
enable = true;
extensions.fzy-native.enable = true;
};
# ========= File Nav ===========
#
plugins.harpoon = {
enable = true;
keymaps = {
toggleQuickMenu = "<leader>b";
};
};
plugins.nvim-tree = {
enable = true;
view.width = {
min = 30;
max = -1;
padding = 1;
};
disableNetrw = true;
filters.dotfiles = true;
};
#
# ========== Dev Tools =========
#
plugins.surround.enable = true; # vim-surround
plugins.gitsigns = {
enable = true;
settings.signs.add = {
hl = "GitSignsAdd";
text = " ";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
settings.signs.change = {
hl = "GitSignsChange";
text = " ";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
settings.signs.delete = {
hl = "GitSignsDelete";
text = " ";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
settings.signs.topdelete = {
hl = "GitSignsDelete";
text = " ";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
settings.signs.changedelete = {
hl = "GitSignsChange";
text = " ";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
};
# Load Plugins that aren't provided as modules by nixvim
extraPlugins = builtins.attrValues {
inherit (pkgs.vimPlugins)
ale
vim-numbertoggle# Use relative number on focused buffer only
vimade# Dim unfocused buffers
vimwiki# Vim Wiki
YouCompleteMe# Code completion engine
vim-dadbod
vim-dadbod-ui
# Keep vim-devicons as last entry
vim-devicons;
};
# ========= Mapleader =========
globals.mapleader = ";";
#
# ========= Key binds =========
#
keymaps = [
# Switching windows
{
mode = [ "n" ];
action = "<C-W>h";
key = "<S-h>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>j";
key = "<S-j>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>k";
key = "<S-k>";
options = {
silent = true;
};
}
{
mode = [ "n" ];
action = "<C-W>l";
key = "<S-l>";
options = {
silent = true;
};
}
# Toggle nvim-tree
{
mode = [ "n" ];
action = "<cmd>NvimTreeFindFileToggle<CR>";
key = "tt";
options = {
silent = true;
};
}
{
# clear search highlighting
mode = [ "n" ];
key = "<space><space>";
action = "<cmd>nohlsearch<CR>";
options = { noremap = true; };
}
# ========== Telescope Plugin =========
{
# find files
mode = [ "n" ];
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = { noremap = true; };
}
{
# live grep
mode = [ "n" ];
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = { noremap = true; };
}
{
# buffers
mode = [ "n" ];
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = { noremap = true; };
}
{
# help tags
mode = [ "n" ];
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = { noremap = true; };
}
];
extraConfigVim = ''
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" ================ Vim Wiki config =================
" See :h vimwiki_list for info on registering wiki paths
let wiki_0 = {}
let wiki_0.path = '~/dotfiles.wiki/'
let wiki_0.index = 'home'
let wiki_0.syntax = 'markdown'
let wiki_0.ext = '.md'
" fill spaces in page names with _ in pathing
let wiki_0.links_space_char = '_'
" ================ Ale ========================
" linter and fixer packages have to be installed via AUR or pamac
let g:ale_linters = {
\ 'c': ['clang-tidy'],
\ 'python': ['flake8'],
\ 'vim': ['vint'],
\ 'markdown': ['markdownlint'],
\ }
let g:ale_fixers = {
\ 'c': ['clang-format'],
\ 'javascript': ['prettier', 'eslint'],
\ 'json': ['fixjson', 'prettier'],
\ 'python': ['black', 'isort'],
\ }
" Set global fixers for all file types except Markdown
" Why? because double spaces at the end of a line in markdown indicate a
" linebreak without creating a new paragraph
function! SetGlobalFixers()
let g:ale_fixers['*'] = ['trim_whitespace', 'remove_trailing_lines']
endfunction
augroup GlobalFixers
autocmd!
autocmd VimEnter * call SetGlobalFixers()
augroup END
" Set buffer-local fixers for Markdown files
augroup MarkdownFixers
autocmd!
autocmd FileType markdown let b:ale_fixers = ['prettier']
augroup END
let g:ale_fix_on_save = 1
'';
};
}

View File

@ -1,65 +0,0 @@
{
inputs,
pkgs,
...
}: {
imports = [
inputs.nixvim.homeManagerModules.nixvim
./plugins
./options.nix
./theme.nix
./keymaps.nix
];
# 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
pkgs.glow
];
programs.nixvim = {
enable = true;
package = pkgs.neovim-unwrapped;
enableMan = true; # install man pages for nixvim options
clipboard.register = "unnamedplus"; # use system clipboard instead of internal registers
globals.mapleader = " ";
extraConfigLua = ''
vim.api.nvim_set_keymap("", '<Space>', '<Nop>', { noremap = true, silent = true })
'';
extraConfigVim = ''
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" ================ Vim Wiki config =================
" See :h vimwiki_list for info on registering wiki paths
let wiki_0 = {}
let wiki_0.path = '~/docs/wiki/'
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

@ -1,114 +0,0 @@
{
programs.nixvim.keymaps = [
# Switching buffers
{
mode = ["n"];
action = "<C-w>h";
key = "<S-h>";
options = {silent = true;};
}
{
mode = ["n"];
action = "<C-w>j";
key = "<S-j>";
options = {
silent = true;
};
}
{
mode = ["n"];
action = "<C-w>k";
key = "<S-k>";
options = {
silent = true;
};
}
{
mode = ["n"];
action = "<C-w>l";
key = "<S-l>";
options = {
silent = true;
};
}
# Toggle nvim-tree
{
mode = ["n"];
action = "<cmd>NvimTreeFindFileToggle<CR>";
key = "tt";
options = {
silent = true;
};
}
# Clear search highlighting
{
mode = ["n"];
key = "<space><space>";
action = "<cmd>nohlsearch<CR>";
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;};
}
# indent line in or out
{
mode = ["v"];
key = "<";
action = "<gv";
options = {noremap = true;};
}
{
mode = ["v"];
key = ">";
action = ">gv";
options = {noremap = true;};
}
# move selected line up or down
{
mode = ["v"];
key = "J";
action = ":m '>+1<CR>gv=gv";
options = {noremap = true;};
}
{
mode = ["v"];
key = "K";
action = ":m '<-2<CR>gv=gv";
options = {noremap = true;};
}
];
}

View File

@ -1,37 +0,0 @@
{
programs.nixvim.opts = {
background = "";
number = true; # show line numbers
relativenumber = true; # show relative linenumbers
laststatus = 0; # Display status line always
history = 1000; # Store lots of :cmdline history
showcmd = true; # Show incomplete cmds down the bottom
showmode = true; # Show current mode down the bottom
autoread = true; # Reload files changed outside vim
lazyredraw = true; # Redraw only when needed
showmatch = true; # highlight matching braces
ruler = true; # show current line and column
visualbell = true; # No sounds
listchars = "trail:·"; # Display tabs and trailing spaces visually
autoindent = true;
cindent = true; # automatically indent braces
smartindent = true;
smarttab = true;
shiftwidth = 2;
softtabstop = 4;
tabstop = 2;
expandtab = true;
wildmode = "list:longest";
wildmenu = true; # enable ctrl-n and ctrl-p to scroll thru matches
scrolloff = 4; # Start scrolling when we're 4 lines away from margins
sidescrolloff = 15;
sidescroll = 1;
incsearch = true;
hlsearch = true;
ignorecase = true;
smartcase = true;
backspace = "indent,eol,start"; # allow backspace in insert mode
spell = true;
spelllang = "en_gb";
};
}

View File

@ -1,109 +0,0 @@
{
programs.nixvim.plugins = {
cmp-emoji = { enable = true; };
cmp = {
enable = true;
cmdline = {};
settings = {
autoEnableSources = true;
experimental = { ghost_text = true; };
performance = {
debounce = 60;
fetchingTimeout = 200;
maxViewEntries = 30;
};
snippet = { expand = "function(args) require('luasnip').lsp_expand(args.body) end"; };
formatting = {
fields = [ "kind" "abbr" "menu" ];
format = ''
function(entry, vim_item)
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
luasnip = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
["vim-dadbod-completion"] = "[SQL-dadbod]"
})[entry.source.name]
return vim_item
end,
'';
};
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lua"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "path"; }
{ name = "vim-dadbod-completion"; }
];
window = {
completion = { border = "solid"; };
documentation = { border = "solid"; };
};
mapping = {
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<S-Tab>" = "cmp.mapping.select_prev_item()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
};
};
};
cmp-nvim-lsp = { enable = true; }; # lsp
cmp-buffer = { enable = true; };
cmp-path = { enable = true; }; # file system paths
cmp_luasnip = { enable = true; }; # snippets
cmp-cmdline = { enable = true; }; # autocomplete for cmdline
};
programs.nixvim.extraConfigLua = ''
luasnip = require("luasnip")
kind_icons = {
Text = "󰊄",
Method = "",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "󱀍",
Class = "",
Interface = "",
Module = "󰕳",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
local cmp = require'cmp'
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({'/', "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
}) '';
}

View File

@ -1,6 +0,0 @@
{
programs.nixvim.plugins.nvim-colorizer = {
enable = true;
fileTypes = [ "*" ];
};
}

View File

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

View File

@ -1,53 +0,0 @@
{
programs.nixvim.plugins.conform-nvim = {
enable = true;
notifyOnError = true;
logLevel = "debug";
formattersByFt = {
html = ["prettierd"];
css = ["prettierd"];
javascript = ["prettierd"];
python = ["black"];
lua = ["stylua"];
nix = ["alejandra"];
markdown = ["prettierd"];
yaml = ["yamlfmt"];
sql = ["sqlfmt"];
#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
}
'';
programs.nixvim.keymaps = [
# format document with Conform
{
mode = ["n"];
key = "<leader>cf";
action = "<CMD>Format<CR>";
options = {
silent = true;
desc = "Conform auto-format document";
};
}
];
}

View File

@ -1,162 +0,0 @@
{
pkgs,
config,
...
}: let
user = config.home.username;
in {
imports = [
./cmp.nix
./colorizer.nix
./conform.nix
./gitsigns.nix
./harpoon.nix
./lsp.nix
./lualine.nix
./luasnip.nix
./nvim-tree.nix
./surround.nix
./telescope.nix
./treesitter.nix
./fold.nix
./todo-comments.nix
./oil.nix
./comment.nix
];
# Load Plugins that aren't provided as modules by nixvim
programs.nixvim.extraPlugins = [
pkgs.vimPlugins.vim-numbertoggle
pkgs.vimPlugins.vimwiki
pkgs.vimPlugins.vim-dadbod
pkgs.vimPlugins.vim-dadbod-ui
pkgs.vimPlugins.vim-dadbod-completion
pkgs.vimPlugins.fugitive
(pkgs.vimUtils.buildVimPlugin
{
name = "glow.nvim";
src = pkgs.fetchFromGitHub {
owner = "ellisonleao";
repo = "glow.nvim";
rev = "238070a";
sha256 = "sha256-GsNcASzVvY0066kak2nvUY5luzanoBclqcUOsODww8g=";
};
})
(pkgs.vimUtils.buildVimPlugin
{
name = "buffer_manager.nvim";
src = pkgs.fetchFromGitHub {
owner = "j-morano";
repo = "buffer_manager.nvim";
rev = "fd36131";
sha256 = "sha256-abe9ZGmL7U9rC+LxC3LO5/bOn8lHke1FCKO0V3TZGs0=";
};
})
(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
];
programs.nixvim.extraConfigLua = ''
-- function to read api key from secrets file
local function read_api_key(file_path)
local file = io.open(file_path, "r")
if file then
local api_key = file:read("*all")
file:close()
return api_key
else
error("Failed to open file: " .. file_path)
end
end
-- buffer_manager.nvim
local opts = {noremap = true}
require("buffer_manager").setup(
{
line_keys = "1234567890",
select_menu_item_commands = {
edit = {
key = "<CR>",
command = "edit"
}
},
focus_alternate_buffer = true,
short_file_names = false,
short_term_names = true,
height = 15,
width = 0.8,
loop_nav = true,
highlight = "",
win_extra_options = {},
borderchars = { "", "", "", "", "", "", "", "" },
order_buffers = "lastused",
show_indicators = "before",
}
)
require('glow').setup({
border = "shadow",
style = "dark",
pager = false,
width = 80,
height = 100,
width_ratio = 0.7,
height_ratio = 0.7,
})
-- Custom color for modified buffers
vim.api.nvim_set_hl(0, "BufferManagerModified", { fg = "#988100" })
local bmui = require("buffer_manager.ui")
vim.keymap.set('n', '<leader>b', bmui.toggle_quick_menu, opts)
vim.keymap.set('n', '<leader>n', bmui.nav_next, opts)
vim.keymap.set('n', '<leader>p', bmui.nav_prev, opts)
local keys="1234567890"
for i = 1, #keys do
local key = keys:sub(i,i)
vim.keymap.set('n', string.format('<leader>%s', key),
function () bmui.nav_file(i) end,
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

@ -1,31 +0,0 @@
{
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,35 +0,0 @@
{
programs.nixvim.plugins.gitsigns = {
enable = true;
settings.signs.add = {
hl = "GitSignsAdd";
text = " ";
numhl = "GitSignsAddNr";
linehl = "GitSignsAddLn";
};
settings.signs.change = {
hl = "GitSignsChange";
text = " ";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
settings.signs.delete = {
hl = "GitSignsDelete";
text = " ";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
settings.signs.topdelete = {
hl = "GitSignsDelete";
text = " ";
numhl = "GitSignsDeleteNr";
linehl = "GitSignsDeleteLn";
};
settings.signs.changedelete = {
hl = "GitSignsChange";
text = " ";
numhl = "GitSignsChangeNr";
linehl = "GitSignsChangeLn";
};
};
}

View File

@ -1,9 +0,0 @@
{
programs.nixvim.plugins.harpoon = {
enable = true;
keymaps = {
toggleQuickMenu = "<leader>h";
addFile = "<leader>a";
};
};
}

View File

@ -1,74 +0,0 @@
{ osConfig , ... }:
let
hostname = osConfig.networking.hostName;
in
{
programs.nixvim.plugins = {
lsp = {
enable = true;
servers = {
lua-ls = {enable = true;};
nixd = {
enable = true;
cmd = ["nixd"];
settings = {
nixpkgs.expr = "import <nixpkgs> { }";
options = {
nixos.expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.${hostname}.options";
# TODO get home-manager options working when hm imported as submodule
# home_manager.expr = "(builtins.getFlake \"github:nix-community/home-manager\").homeConfigurations.${hostname}.options";
};
};
};
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 = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
gK = {
action = "hover";
desc = "Hover";
};
"<leader>cw" = {
action = "workspace_symbol";
desc = "Workspace Symbol";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
};
};
# TODO: enable otter.nvim when merged into nixvim stable
# otter = {
# enable = true;
# };
};
}

View File

@ -1,13 +0,0 @@
{
# Add tiny pictograms to lsp
programs.nixvim.plugins.lspkind = {
enable = true;
symbolMap = {
Copilot = "";
};
extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};
};
}

View File

@ -1,22 +0,0 @@
{
programs.nixvim.plugins.lualine = {
enable = true;
theme = "auto";
componentSeparators = {
left = "";
right = "";
};
sectionSeparators = {
left = "";
right = "";
};
sections = {
lualine_a = [ "mode" ];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "filename" ];
lualine_x = [ "encoding" "fileformat" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "locations" ];
};
};
}

View File

@ -1,15 +0,0 @@
{ pkgs, ... }: {
programs.nixvim.plugins.luasnip = {
enable = true;
extraConfig = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
fromVscode = [
{
lazyLoad = true;
paths = "${pkgs.vimPlugins.friendly-snippets}";
}
];
};
}

View File

@ -1,12 +0,0 @@
{
programs.nixvim.plugins.nvim-tree = {
enable = true;
view.width = {
min = 30;
max = -1;
padding = 1;
};
disableNetrw = true;
filters.dotfiles = true;
};
}

View File

@ -1,9 +0,0 @@
{
programs.nixvim.plugins.oil = {
enable = true;
settings = {
columns = ["icon"];
view_options.show_hidden = true;
};
};
}

View File

@ -1,3 +0,0 @@
{
programs.nixvim.plugins.surround.enable = true; # vim-surround
}

View File

@ -1,50 +0,0 @@
{
programs.nixvim.plugins.telescope = {
enable = true;
extensions.fzy-native.enable = true;
};
programs.nixvim.keymaps = [
{
# find files
mode = ["n"];
key = "<Leader>ff";
action = "<cmd>Telescope find_files<CR>";
options = {noremap = true;};
}
{
# live grep
mode = ["n"];
key = "<Leader>fg";
action = "<cmd>Telescope live_grep<CR>";
options = {noremap = true;};
}
{
# grep string under cursor
mode = ["n"];
key = "<Leader>fs";
action = "<cmd>Telescope string_grep<CR>";
options = {noremap = true;};
}
{
# buffers
mode = ["n"];
key = "<Leader>fb";
action = "<cmd>Telescope buffers<CR>";
options = {noremap = true;};
}
{
# help tags
mode = ["n"];
key = "<Leader>fh";
action = "<cmd>Telescope help_tags<CR>";
options = {noremap = true;};
}
{
# show recently opened files
mode = ["n"];
key = "<Leader>fo";
action = "<cmd>Telescope oldfiles<CR>";
options = {noremap = true;};
}
];
}

View File

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

View File

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

View File

@ -1,14 +0,0 @@
{
programs.nixvim.colorschemes.kanagawa = {
enable = true;
settings = {
commentStyle = {
italic = true;
};
terminalColors = true;
theme = "wave";
transparent = true;
undercurl = true;
};
};
}

View File

@ -1,4 +1,4 @@
{ config, ... }: { { pkgs, config, ... }: {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -8,10 +8,6 @@
shellAliases = { shellAliases = {
ll = "ls -l"; ll = "ls -l";
src = "cd ~/.local/share/src";
no = "cd /etc/nixos";
cat = "bat --decorations=never";
ls = "eza";
}; };
history.size = 10000; history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history"; history.path = "${config.xdg.dataHome}/zsh/history";
@ -86,23 +82,6 @@
HISTSIZE=10000000 HISTSIZE=10000000
SAVEHIST=10000000 SAVEHIST=10000000
setopt appendhistory setopt appendhistory
# Change cursor shape for different vi modes.
function zle-keymap-select () {
case $KEYMAP in
vicmd) echo -ne '\e[1 q';; # block
viins|main) echo -ne '\e[5 q';; # beam
esac
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
''; '';
}; };
} }

View File

@ -1,16 +0,0 @@
{
home.file.".config/autostart/feh-wallpaper-changer.desktop" = {
recursive = true;
text = ''
[Desktop Entry]
Type=Application
Exec=feh-wallpaper-changer
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_GB]=feh-wallpaper-changer
Comment[en_GB]=Periodically changes the wallpaper using feh
X-GNOME-Autostart-Delay=5
'';
};
}

View File

@ -1,29 +0,0 @@
{ pkgs, ... }: {
home.file.".config/cinnamon-monitors".text = ''
<monitors version="2">
<configuration>
${builtins.concatStringsSep "\n" (map (monitor: ''
<logicalmonitor>
<x>${toString monitor.x}</x>
<y>${toString monitor.y}</y>
<scale>${toString monitor.scale}</scale>
${if monitor.primary then "<primary>yes</primary>" else ""}
<monitor>
<monitorspec>
<connector>${toString monitor.name}</connector>
<vendor>${toString monitor.vendor}</vendor>
<product>${toString monitor.product}</product>
<serial>${toString monitor.serial}</serial>
</monitorspec>
<mode>
<width>${toString monitor.width}</width>
<height>${toString monitor.height}</height>
<rate>${toString monitor.refreshRate}</rate>
</mode>
</monitor>
</logicalmonitor>
''))}
</configuration>
</monitors>
'';
}

View File

@ -1,9 +0,0 @@
{
imports = [
../common
../common/x11
./autostart.nix
# This doesn't seem to work in Cinnamon
#./cinnamon-monitors.nix
];
}

View File

@ -1,51 +0,0 @@
{ config, pkgs, ... }:
{
programs.alacritty = {
enable = true;
settings = {
colors = with config.colorScheme.palette; {
bright = {
black = "0x${base03}";
blue = "0x${base04}";
cyan = "0x${base0F}";
green = "0x${base01}";
magenta = "0x${base06}";
red = "0x${base09}";
white = "0x${base07}";
yellow = "0x${base02}";
};
cursor = {
cursor = "0x${base05}";
text = "0x${base00}";
};
normal = {
black = "0x${base00}";
blue = "0x${base0D}";
cyan = "0x${base0C}";
green = "0x${base0B}";
magenta = "0x${base0E}";
red = "0x${base08}";
white = "0x${base05}";
yellow = "0x${base0A}";
};
primary = {
background = "0x${base00}";
foreground = "0x${base05}";
};
};
window = {
padding = {
x = 5;
y = 5;
};
blur = true;
opacity = 0.9;
};
shell.program = "${pkgs.zsh}/bin/zsh";
};
};
}

View File

@ -1,34 +0,0 @@
{pkgs, ...}: {
imports = [
./firefox.nix
./alacritty.nix
./zotero.nix
./fontconfig.nix
];
# Global packages for desktop environments
home.packages = [
pkgs.alacritty
pkgs.libnotify
pkgs.zathura
pkgs.xfce.thunar
pkgs.kcolorchooser
pkgs.zotero
pkgs.transmission
pkgs.mpv
pkgs.gnome.simple-scan
pkgs.pandoc
pkgs.texlive.combined.scheme-small
pkgs.libreoffice-fresh
pkgs.hunspell
pkgs.hunspellDicts.en-gb-large
pkgs.hunspellDicts.en-gb-large
pkgs.hunspellDicts.en_US
pkgs.set_wm_class
pkgs.xorg.xkill
pkgs.krita
pkgs.R
pkgs.gimp
pkgs.gajim
];
}

View File

@ -1,101 +0,0 @@
{
pkgs,
config,
configVars,
...
}: let
user = config.home.username;
jellyfinIp = configVars.networking.addresses.jellyfin.ip;
jellyfinPort = configVars.networking.addresses.jellyfin.port;
bitcoinNodeIp = configVars.networking.addresses.bitcoin-node.ip;
mempoolPort = configVars.networking.addresses.bitcoin-node.services.mempool.port;
in {
programs.firefox = {
enable = true;
profiles.${user} = {
search = {
force = true;
default = "Searx";
order = ["Searx" "DuckDuckGo"];
engines = {
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
"NixOS Wiki" = {
urls = [{template = "https://nixos.wiki/index.php?search={searchTerms}";}];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@nw"];
};
"Searx" = {
urls = [{template = "http://10.0.10.35:8855/?q={searchTerms}";}];
iconUpdateURL = "https://docs.searxng.org/_static/searxng-wordmark.svg";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = ["@searx"];
};
"Bing".metaData.hidden = true;
"Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias
};
};
bookmarks = [
{
name = "toolbar";
toolbar = true;
bookmarks = [
{
name = "Jellyfin";
url = "http://${jellyfinIp}:${jellyfinPort}";
}
{
name = "Mempool";
url = "http://${bitcoinNodeIp}:${toString mempoolPort}";
}
{
name = "Nixos Package Search";
url = "https://search.nixos.org/packages";
}
];
}
];
settings = {
"dom.security.https_only_mode" = true;
"browser.download.panel.shown" = true;
"identity.fxaccounts.enabled" = false;
"signon.rememberSignons" = false;
"browser.compactmode.show" = true;
"browser.startup.homepage" = "http://10.0.10.35:8855";
"browser.search.defaultenginename" = "Searx";
"browser.search.order.1" = "Searx";
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
return-youtube-dislikes
bitwarden
sponsorblock
darkreader
vimium
privacy-badger
zotero-connector
];
};
};
}

View File

@ -1,24 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
nerdfonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
hack-font
liberation_ttf
libertine
font-awesome
];
fonts = {
fontconfig = {
enable = true;
defaultFonts = {
serif = [ "NotoSans Nerd Font" ];
sansSerif = [ "Linux Biolinum O" ];
monospace = [ "Hack Nerd Font" ];
};
};
};
}

View File

@ -1,13 +0,0 @@
{
pkgs,
...
}: {
programs.kodi = {
enable = true;
package = pkgs.kodi.withPackages (kodiPkgs:
with kodiPkgs; [
netflix
jellycon
]);
};
}

View File

@ -1,51 +0,0 @@
{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
];
# 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 = {
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";
qt.style.name = "adwaita-dark";
qt.style.package = pkgs.adwaita-qt;
}

View File

@ -1,14 +0,0 @@
{ pkgs, ... }:
{
imports = [
./mako.nix
./waybar.nix
./swww-wallpaper-changer.nix
];
home.packages = [
pkgs.wofi
pkgs.wl-clipboard
pkgs.pyprland
];
}

View File

@ -1,12 +0,0 @@
{ pkgs, config, ... }:
{
services.mako = {
enable = true;
backgroundColor = "#${config.colorScheme.colors.base00}";
borderColor = "#${config.colorScheme.colors.base0D}";
borderRadius = 5;
borderSize = 2;
textColor = "#${config.colorScheme.colors.base05}";
layer = "overlay";
};
}

View File

@ -1,19 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "swww-wallpaper-changer" ''
export WAYLAND_DISPLAY="wayland-1"
wallpaper_dir="$HOME/.local/share/bg/"
[ -d "$wallpaper_dir" ] || mkdir -p "$wallpaper_dir"
${swww}/bin/swww-daemon &
while true; do
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
${swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60
[ $? != 0 ] && echo "swww failed, exiting" && exit 1
sleep 600
done
done
'')
];
}

View File

@ -1,230 +0,0 @@
{ lib
, config
, pkgs
, ...
}: {
# Let it try to start a few more times
systemd.user.services.waybar = {
Unit.StartLimitBurst = 30;
};
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
primary = {
mode = "dock";
height = 30;
margin = "6";
spacing = 5;
modules-left = [
"custom/menu"
"hyprland/workspaces"
"hyprland/window"
];
modules-center = [
"clock"
];
modules-right = [
"cpu"
"memory"
"network"
"pulseaudio"
"battery"
"tray"
"custom/exit"
"custom/hostname"
"custom/ip"
];
"hyprland/window" = {
"format" = "{}";
"rewrite" = {
"(.*) Mozilla Firefox" = "$1";
};
"separate-outputs" = true;
};
"hyprland/workspaces" = {
"format" = "{name}";
"on-click" = "activate";
"format-icons" = {
"urgent" = "";
"active" = "";
"default" = "";
};
};
"clock" = {
"format" = "<span> </span>{:%y-%m-%d %H:%M:%S}";
"tooltip-format" = "<big>{:%B %Y}</big>\n<tt><small>{calendar}</small></tt>";
"on-click" = "calendar";
};
"cpu" = {
"interval" = 10;
"format" = " {}%";
"max-length" = 10;
"on-click" = "";
};
"memory" = {
"interval" = 30;
"format" = " {}%";
"format-alt" = " {used:0.1f}G";
"max-length" = 10;
};
"network" = {
"format-wifi" = " {signalStrength}%";
"format-ethernet" = " wired ({ipaddr})";
"format-disconnected" = "";
};
"battery" = {
"bat" = "BAT0";
"adapter" = "ADP0";
"interval" = 60;
"states" = {
"warning" = 30;
"critical" = 15;
};
"max-length" = 20;
"format" = "{icon} {capacity}%";
"format-warning" = "{icon} {capacity}%";
"format-critical" = "{icon} {capacity}%";
"format-charging" = "<span font-family='Font Awesome 6 Free'></span> {capacity}%";
"format-plugged" = " {capacity}%";
"format-alt" = "{icon} {time}";
"format-full" = " {capacity}%";
"format-icons" = [ " " " " " " " " " " ];
};
"tray" = {
"spacing" = 10;
};
"custom/menu" = {
"format" = " Nixos";
"on-click" = "wofi --show drun";
};
"custom/hostname" = {
"exec" = "echo $USER@$(hostname)";
"on-click" = "$TERMINAL";
};
"custom/exit" = {
"format" = "";
"on-click" = "wlogout";
};
"pulseaudio" = {
"format" = "{icon} {volume}%";
"format-muted" = " 0%";
"format-icons" = {
"headphone" = "";
"headset" = "";
"portable" = "";
"default" = [ "" "" "" ];
};
"on-click" = "pypr toggle volume";
};
};
};
style = ''
* {
font-family: JetBrainsMono Nerd Font;
font-size: 12pt;
padding: 0 8px;
}
.modules-right {
margin-right: -15px;
}
.modules-left {
margin-left: -15px;
}
window#waybar {
color: white;
background-color: #002635;
opacity: 0.95;
padding: 0;
border-radius: 10px;
}
window#waybar.bottom {
opacity: 0.90;
background-color: #002635;
border: 2px solid #14747e;
border-radius: 10px;
}
#workspaces button {
padding: 0 5px;
color: #7984A4;
background-color: transparent;
box-shadow: inset 0 -3px transparent;
border: none;
border-radius: 0;
}
#workspaces button.hidden {
background-color: #002635;
color: #869696;
}
#workspaces button.focused {
color: #bf616a;
}
#workspaces button.active {
color: #6a92d7;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#clock {
padding-left: 15px;
padding-right: 15px;
margin-top: 0;
margin-bottom: 0;
border-radius: 10px;
}
#tray {
color: #a1a19a;
}
#custom-hostname {
background-color: white;
color: #002635;
padding-left: 15px;
padding-right: 18px;
margin-right: 0;
margin-top: 0;
margin-bottom: 0;
border-radius: 10px;
}
#custom-menu {
font-size: 16pt;
background-color: white;
color: #002635;
padding-left: 15px;
padding-right: 22px;
margin-left: 0;
margin-right: 10px;
margin-top: 0;
margin-bottom: 0;
border-radius: 10px;
}
'';
};
}

View File

@ -1,19 +0,0 @@
{ pkgs, ... }:
{
imports = [
./scripts/feh-wallpaper-changer.nix
];
home.packages = [
pkgs.flameshot
pkgs.st
pkgs.xclip
pkgs.feh
];
programs.chromium = {
enable = true;
package = pkgs.brave;
};
}

View File

@ -1,36 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "feh-wallpaper-changer" ''
# Kill previous instance if exists
script_name=''${BASH_SOURCE[0]}
for pid in $(pidof -x $script_name); do
if [ $pid != $$ ]; then
kill -9 $pid
fi
done
wallpaper_dir="$HOME/.local/share/bg/"
if [ ! -d "$wallpaper_dir" ]; then
echo "No wallpapers in $wallpaper_dir, cloning from remote"
mkdir -p "$wallpaper_dir"
git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection"
[ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1
fi
pics_exist=$(find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \))
if [ -z "$pics_exist" ]; then
git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection"
[ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1
fi
while true; do
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
${feh}/bin/feh --bg-fill "$file"
[ $? != 0 ] && echo "feh failed, exiting" && exit 1
sleep 600
done
done
'')
];
}

View File

@ -1,33 +0,0 @@
{ pkgs, config, ... }:
let
user = config.home.username;
in
{
home.packages = [
pkgs.zotero
];
home.file.".zotero/zotero/profiles.ini".text = ''
[General]
StartWithLastProfile=1
[Profile0]
Name=default
IsRelative=1
Path=zprofile.default
Default=1
'';
home.file.".zotero/zotero/zprofile.default/user.js".text = ''
user_pref("extensions.zotero.dataDir", "/home/${user}/.local/share/Zotero");
user_pref("extensions.zotero.firstRun.skipFirefoxProfileAccessCheck", true);
user_pref("extensions.zotero.firstRun2", false);
user_pref("extensions.zotero.useDataDir", true);
user_pref("intl.accept_languages", "en-GB, en");
user_pref("extensions.zotero.sync.server.username", "samual.shop@proton.me");
user_pref("extensions.zotero.sync.fulltext.enabled", false);
user_pref("extensions.zotero.sync.storage.enabled", false);
user_pref("extensions.zotero.sync.storage.groups.enabled", false);
'';
}

View File

@ -1,48 +0,0 @@
{ pkgs, ... }:
{
imports = [
../common
../common/x11
./xinitrc.nix
./sxhkdrc.nix
./picom.nix
./dunst.nix
./music_player.nix
# Status bar scripts
./scripts/sb-cpu-pct.nix
./scripts/sb-mem-pct.nix
./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
./scripts/clipboard-save.nix
./scripts/clipboard-recall.nix
./scripts/get-focused-monitor.nix
./scripts/git-commit-ai.nix
./scripts/aichat-wrapper.nix
./scripts/dmenu-wifi.nix
./scripts/battery-status.nix
./scripts/dmenu-set-wm-class.nix
./scripts/key-remaps.nix
];
home.packages = [
pkgs.dwmblocks
pkgs.dmenu
pkgs.dunst
pkgs.picom
pkgs.sxhkd
pkgs.nsxiv
pkgs.unstable.aichat
pkgs.toipe
];
}

View File

@ -1,179 +0,0 @@
{ pkgs, config, ... }: {
home.packages = builtins.attrValues {
inherit (pkgs)
libnotify; # required by dunst
};
services.dunst = {
enable = true;
iconTheme = {
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = "16x16";
};
settings = {
global = {
# Allow a small subset of html markup:<b></b>, <i></i>, <s></s>, and <u></u>.
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
# If markup is not allowed, those tags will be stripped out of the message.
markup = "yes";
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# Markup is allowed
#format = ''%I %s %p\n%b'';
format = ''<b>%s:</b>\n%b\n\n%a '';
font = "monospace";
# Options are "left", "center", and "right".
alignment = "left";
# Sort messages by urgency.
sort = "yes";
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = "yes";
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = 60;
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = "no";
# Ignore newlines '\n' in notifications.
ignore_newline = "no";
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectevly.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
# geometry = "400x0-15+60";
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = "yes";
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a windowmanager that exports the _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern windowmanagers.
#
# If this option is set to mouse or keyboard, the monitor option will be ignored.
follow = "none";
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = "yes";
# Maximum amount of notifications kept in history
history_length = 20;
# Display indicators for URLs (U) and actions (A).
show_indicators = "yes";
# The height of a single line. If the height is smaller than the
# font height, it will get raised to the font height.
# This adds empty space above and under the text.
line_height = 0;
# Draw a line of "separator_height" pixel height between two
# notifications. Set to 0 to disable.
separator_height = 0;
# Gap between messages - requires compositor
gap_size = 4;
# Padding between text and separator.
padding = 10;
# Horizontal padding.
horizontal_padding = 10;
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing windowmanager is
# present (e.g. xcompmgr, compiz, etc.).
transparency = 0;
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = "frame";
# Align icons left/right/off
icon_position = "left";
width = 400;
height = 300;
offset = "15x60";
origin = "top-right";
frame_color = "#${config.colorScheme.colors.base0B}";
frame_width = 2;
# Browser for opening urls in context menu.
browser = "firefox";
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = "ctrl+space";
# Close all notifications.
close_all = "ctrl+shift+space";
# Redisplay last message(s).
history = "ctrl+shift+h";
# Context menu.
context = "ctrl+shift+c";
};
urgency_low = {
background = "#${config.colorScheme.colors.base03}";
foreground = "#${config.colorScheme.colors.base05}";
timeout = 15;
};
urgency_normal = {
background = "#${config.colorScheme.colors.base03}";
foreground = "#${config.colorScheme.colors.base05}";
timeout = 15;
};
urgency_critical = {
background = "#${config.colorScheme.colors.base08}";
foreground = "#${config.colorScheme.colors.base05}";
frame_color = "#${config.colorScheme.colors.base05}";
timeout = 0;
};
};
};
}

View File

@ -1,65 +0,0 @@
{ pkgs, config, ... }:
{
home.file."mus/music_data".source = config.lib.file.mkOutOfStoreSymlink /media/media/music/music_data;
home.packages = [
pkgs.ffmpeg
pkgs.nsxiv
pkgs.kunst
pkgs.mpc-cli
pkgs.jq
pkgs.imagemagick
];
services.mpd = {
enable = true;
package = pkgs.mpd;
extraConfig = ''
music_directory "~/mus/music_data"
playlist_directory "~/.local/share/mpd/playlists"
log_file "~/.local/share/mpd/log"
db_file "~/.local/share/mpd/database"
pid_file "~/.local/share/mpd/pid"
state_file "~/.local/share/mpd/state"
sticker_file "~/.local/share/mpd/sticker.sql"
auto_update "yes"
audio_output {
type "pipewire"
name "PipeWire Sound Server"
}
audio_output {
type "fifo"
name "Visualizer feed"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
musicDirectory = "~/mus/music_data";
};
programs.ncmpcpp = {
enable = true;
package = (pkgs.ncmpcpp.override { visualizerSupport = true; });
mpdMusicDir = "~/mus/music_data";
settings = {
mpd_host = "127.0.0.1";
mpd_port = "6600";
visualizer_data_source = "/tmp/mpd.fifo";
visualizer_output_name = "Visualizer Feed";
visualizer_in_stereo = "yes";
visualizer_type = "spectrum";
visualizer_fps = "60";
visualizer_autoscale = "no";
visualizer_look = "";
visualizer_color = "169, 170, 169, 135, 134, 133, 129, 128, 127, 126, 125, 124";
visualizer_spectrum_smooth_look = "yes";
visualizer_spectrum_dft_size = "3";
};
};
}

View File

@ -1,17 +0,0 @@
{
home.file.".config/picom/picom.conf" = {
recursive = true;
text = ''
vsync = true;
backend = "xrender";
shadow = true;
shadow-radius = 10;
shadow-offset-x = -5;
shadow-offset-y = -5;
fading = true;
fade-in-step = 0.2;
fade-out-step = 0.2;
fade-delta = 50;
'';
};
}

View File

@ -1,12 +0,0 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.writeShellScriptBin "aichat-wrapper" ''
#!/usr/bin/env bash
model=$(${pkgs.aichat}/bin/aichat --list-models | ${pkgs.fzf}/bin/fzf)
${pkgs.aichat}/bin/aichat --model "$model"
'')
];
}

View File

@ -1,54 +0,0 @@
{ 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

@ -1,87 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "clipboard-text-recall" ''
# Function to convert seconds to days, hours, minutes or seconds
clipboard_dir="/tmp/clipboard/text/*"
function format_time() {
local diff=$1
if ((diff<60)); then
echo "''${diff} seconds"
elif ((diff<3600)); then
echo "''$((diff/60)) minutes"
elif ((diff<86400)); then
echo "''$((diff/3600)) hours"
else
echo "''$((diff/86400)) days"
fi
}
# Function to get file info and sort it by modification time in reverse order
function get_files_info() {
now=$(date +%s)
# Sort files by modification time before the for loop
sorted_files=( $(ls -t $clipboard_dir) )
for file in "''${sorted_files[@]}"; do
mtime=$(stat -c %Y "$file")
diff=$((now-mtime))
# Get the number of lines in the file
num_lines=$(wc -l <"$file")
# Get the first non-empty line of the file and truncate it to 40 characters
first_line=$(grep . "$file" | head -n 1 | cut -c -60)
echo "$file ($num_lines lines) $(format_time $diff) ago, - '$first_line'..."
done
}
# Usage: get_files_info *
get_files_info $clipboard_dir | ${fzf}/bin/fzf --ansi \
--height 100% \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--preview '${bat}/bin/bat --style=numbers --color=always {1}' \
--preview-window 'up,70%,+{2}+3/3,~3' \
--bind 'enter:become(cat {1} | nohup xclip -loops 0 -i -selection CLIPBOARD >/dev/null 2>&1 && touch {1})'
exit
'')
(writeShellScriptBin "clipboard-image-recall" ''
# Script to view and select and output images in image clipboard dir to clipboard.
monitor_name=$(get-focused-monitor)
monitor_info=$(xrandr | grep "$monitor_name")
width=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f1)
height=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f2)
scale_width=$(( $width/4 + $width/2 ))
scale_height=$(( $height/4 + $height/2 ))
if [ "$1" == "" ] || [ -f "$1" ]; then
notify-send -t 1000 "Clipboard Recall" "Directory not specified or missing."
exit 1
fi
filesdir="$(find $1 -type f -printf '%T@ %p\n' | sort -rn | cut -d ' ' -f 2-)"
[ "$filesdir" == "" ] && notify-send -t 1000 "Clipboard Recall" "No images in directory" && exit 1
output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height" -N nsxiv-float )"
num_lines=$( echo "$output" | wc -l)
if [ "$num_lines" -gt 1 ]; then
echo "More than one image selected, outputting list to clipboard as text"
echo "$output" | ${xclip}/bin/xclip -i -selection CLIPBOARD && ${libnotify}/bin/notify-send "Image to Clipboard" "Paths:\n$output\ncopied to clipboard" -t 5000
elif [ -z "$output" ]; then
echo "Nothing selected"
exit 1
else
echo "Outputted to clipboard"
${xclip}/bin/xclip -selection clipboard -t image/png -i "$output" && ${libnotify}/bin/notify-send "Image to Clipboard" "$output copied to clipboard" -t 5000
fi
'')
];
}

View File

@ -1,37 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "clipboard-save" ''
# Script to automatically save copied images and text in specified directories
while ${clipnotify}/bin/clipnotify
do
image_location="/tmp/clipboard/images"
text_location="/tmp/clipboard/text"
[[ -d $image_location ]] || mkdir -p $image_location
[[ -d $text_location ]] || mkdir -p $text_location
case "$(xclip -selection clipboard -t TARGETS -o)" in
*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=$(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"
;;
*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=$(ls "$text_location" | grep "$filename" | sed "s/\..*//")
echo "$filename" "$file_exists"
[[ "$filename" != "$file_exists" ]] &&
xclip -selection clipboard -t UTF8_STRING -o > "$text_location/$filename"
echo "$text_location/$filename"
touch "$text_location/$filename"
;;
esac
done
'')
];
}

View File

@ -1,13 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dmenu-set-wm-class" ''
${libnotify}/bin/notify-send "Set Window Class" "Select window..."
winid=$(${xorg.xwininfo}/bin/xwininfo | grep "Window id:" | grep -o "0x[0-9a-fA-F]*")
class=$(${xorg.xprop}/bin/xprop -id "$winid" WM_CLASS | grep -o "\".*\"$")
new_class=$( echo "" | ${dmenu}/bin/dmenu -p "Selected: $class. Set class name of window:")
[ -z "$new_class" ] && ${libnotify}/bin/notify-send "Set Window Class" "Nothing set, exiting" && exit
${set_wm_class}/bin/set_wm_class "$winid" "$new_class"
'')
];
}

View File

@ -1,51 +0,0 @@
{ 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

@ -1,9 +0,0 @@
{ 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

@ -1,30 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dunstify-volume-notification" ''
mute_test=$(${pamixer}/bin/pamixer --get-mute)
mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute)
mute=""
if [ "$mute_test" == true ];
then
mute="(Speakers Muted)"
fi
if [ "$mic_mute_test" == true ];
then
mute="(Mic Muted)"
fi
if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ];
then
mute="(Speakers Muted & Mic Muted)"
fi
volume=$(${pamixer}/bin/pamixer --get-volume)
msgTag="volume-notify"
${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000
'')
];
}

View File

@ -1,34 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "emoji-picker" ''
# Define variables
symbols_dir="$HOME/.local/share/symbols"
emoji_file="$symbols_dir/emoji"
nerdfont_file="$symbols_dir/nerdfont"
recent="$symbols_dir/recent"
remote="https://git.bitlab21.com/sam/symbols.git"
# Check if emoji files are installed, if not pull from remote
if [ ! -f "$emoji_file" ] || [ ! -f "$nerdfont_file" ]; then
notify-send -t 5000 "Emoji Picker" "Symbol files not found. Fetching from: '$remote'..."
mkdir -p "$symbols_dir"
git clone "$remote" "$symbols_dir"
[ "$?" != 0 ] && notify-send -t 2000 "Emoji Picker" "Error fetching from: $remote" && exit 1
fi
# Concat all emoji files and pipe into dmenu. Remove empty rows with sed. Exit if invalid selection.
emoji_row=$(cat "$recent" "$emoji_file" "$nerdfont_file" | sed '/^$/d' | dmenu -l 20)
[ "$emoji_row" == "" ] && notify-send -t 1000 "Emoji Picker" "Cancelled" && exit 0
[ "$emoji_row" == "**** Recent ****" ] || [ "$emoji_row" == "****************" ] && notify-send -t 1000 "Emoji Picker" "Invalid selection." && exit 1
# Add selected emoji to recent.
sed -i "/$emoji_row/d" "$recent" && sed -i "2s/^/$emoji_row\n/" "$recent"
# Copy to clipboard
emoji=$(echo "$emoji_row" | sed 's/\s.*//g')
echo "$emoji" | xclip -i -r -selection CLIPBOARD
notify-send -t 5000 "Emoji Picker" "$emoji_row copied to clipboard"
'')
];
}

View File

@ -1,25 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "get-focused-monitor" ''
# get the current cursor location into X and Y variables
eval $(xdotool getmouselocation --shell)
# compare mouse location to monitor coordinates
while IFS= read -r line; do
if [[ $line =~ " connected" ]]; then
display=$(echo "$line" | awk '{print $1}')
coords=$(echo "$line" | grep -oP "\d+x\d+" | tr 'x+' ' ')
read width height x_offset y_offset <<< $coords
if (( X >= x_offset && X <= width + x_offset )) && (( Y >= y_offset && Y <= height + y_offset )); then
echo "$display"
break
fi
fi
done < <(xrandr)
'')
];
}

View File

@ -1,98 +0,0 @@
{ pkgs, ... }:
{
home.packages = [
(pkgs.writers.writePython3Bin
"tiktoken-cli"
{ libraries = [ pkgs.python3Packages.tiktoken ]; }
''
import os
import sys
import tiktoken
content = sys.stdin.read()
default = "gpt-3.5-turbo-0301"
model = os.getenv('TIKTOKEN_MODEL', default)
try:
encoding = tiktoken.encoding_for_model(model)
except KeyError:
encoding = tiktoken.get_encoding(default)
print(len(encoding.encode(content)))
'')
(pkgs.writeShellScriptBin "git-commit-ai" ''
# This bash script performs the following tasks:
# 1. Takes a git diff of modifications made to a repo.
# 2. Passes this diff to an LLM (Large Language Model) that generates a commit
# message.
#
# Usage: ./git-commit-ai --git-diff-commands --model
#
#
diff=$(git diff "$@" )
[ -z "$diff" ] && echo "No diff provided. Did you stage the changes?" && exit 1
tokens=$(echo "$diff" | tiktoken-cli)
echo -e "\n\nEstimated tokens: $tokens\n\n"
choose_model() {
models=$(${pkgs.aichat}/bin/aichat --list-models)
model=$(echo "$models" | fzf)
}
choose_model
git config commit.template ".git/gitmessage"
redo=""
while true
do
[ -z "$redo" ] && echo "Using model: $model" && commit_message=$(${pkgs.aichat}/bin/aichat --model "$model" --role "git_commit" "$diff")
echo ""
echo "Message:"
echo "---------------------------------------------"
echo ""
echo "$commit_message"
echo ""
echo "---------------------------------------------"
echo "What would you like to do?"
echo ""
echo "Copy to clipboard (c)"
echo "Git commit in editor (g)"
echo "Open in editor (e)"
echo "Show diff (d)"
echo "Choose different model (m)"
echo "Exit and do nothing (q)"
read -r -p "Action: (c|g|e|q) " input
case "$input" in
"c") echo "$commit_message" | ${pkgs.xclip}/bin/xclip -i -selection CLIPBOARD &&
${pkgs.libnotify}/bin/notify-send "AI Buddy" "Copied to clipboard"
exit 0
;;
"g") echo "$commit_message" > ".git/gitmessage" &&
git commit -e
cat /dev/null > ".git/gitmessage" # clear the template
exit 0
;;
"d") echo -e "Current commit message:\n\n$commit_message\n\nDiff file:\n\n$diff" | less
redo=true
shift
;;
"e") echo "$commit_message" | nvim -
exit 0
;;
"m") choose_model && shift
;;
"q") exit 0
;;
*) exit 0
esac
done
'')
];
}

View File

@ -1,11 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
(writeShellScriptBin "key-remaps" ''
${xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch"
${xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H"
${xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J"
${xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K"
${xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L"
'')
];
}

View File

@ -1,37 +0,0 @@
{ 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

@ -1,8 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-cpu-pct" ''
echo "[󰻠 $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g")] "
'')
];
}

View File

@ -1,9 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-mem-pct" ''
# Gets current ram percent utilisation
echo "[󰍛 $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}')] "
'')
];
}

View File

@ -1,52 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-network-status" ''
# Nerd Font Symbols
wifi_symbol=" "
lan_symbol="󰌗 "
disconnected_symbol="󰲜 "
vpn_symbol="󰖂 "
internet="󰞉 "
internet_disconnected="󰪎 "
# Get the network status
DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq)
IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
if [ -z "$DEFAULT_INTERFACE" ]; then
network_symbol="$disconnected_symbol"
else
# Check if it is a wireless interface (wlan*)
if [[ $DEFAULT_INTERFACE == wl* ]]; then
network_symbol="$wifi_symbol"
else
network_symbol="$lan_symbol"
fi
fi
# Check internet connectivity
if ! ping -c 1 8.8.8.8 &> /dev/null;
then
network_symbol="$network_symbol $internet_disconnected"
else
network_symbol="$network_symbol $internet"
fi
if ip addr show tun0 > /dev/null 2>&1; then
network_symbol="$network_symbol $vpn_symbol"
else
network_symbol="$network_symbol"
fi
if [ -z "$IP_ADDRESS" ];
then
printf "[$network_symbol] "
else
printf "[$network_symbol|$IP_ADDRESS] "
fi
'')
];
}

View File

@ -1,14 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(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] "
'')
];
}

View File

@ -1,35 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "sb-volume" ''
# Prints the current volume or 婢 if muted.
get_mic_status=$(${pamixer}/bin/pamixer --default-source --get-mute)
vol="$(${pamixer}/bin/pamixer --get-volume)"
if [ $get_mic_status == false ]; then
mic_status=""
else
mic_status=""
fi
if [ "$vol" -gt "90" ]; then
icon="󰕾"
elif [ "$vol" -gt "50" ]; then
icon="󰖀"
elif [ "$vol" -gt "0" ]; then
icon="󰕿"
else
icon="󰝟"
fi
if [ $(${pamixer}/bin/pamixer --get-mute) = true ]; then
icon="󰸈"
vol="0"
fi
print_string="$mic_status $icon $vol%"
printf '%s' "[''${print_string}] "
'')
];
}

View File

@ -1,34 +0,0 @@
{
# TODO: add emoji and dmenu-dict scripts
home.file.".config/sxhkd/sxhkdrc" = {
recursive = true;
text = ''
XF86AudioRaiseVolume
pamixer --set-limit 150 --allow-boost -i 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86AudioLowerVolume
pamixer --set-limit 150 --allow-boost -d 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86AudioMute
pamixer --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86AudioMicMute
pamixer --default-source --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1
XF86Messenger
dunstify-battery-notification
control + F8
clipboard-image-recall /tmp/clipboard/images/
Print
env QT_AUTO_SCREEN_SCALE_FACTOR=1.5 QT_SCREEN_SCALE_FACTORS="" flameshot gui
control + F7
emoji-picker
control + F4
dmenu-set-wm-class
'';
};
}

View File

@ -1,31 +0,0 @@
{...}: {
# TODO: configure x11 to look in .config/x11
home.file.".xinitrc" = {
recursive = true;
text = ''
picom -b --config ~/.config/picom/picom.conf
xrdb -merge ~/.Xresources
autostart="clipboard-save dwmblocks feh-wallpaper-changer sxhkd key-remaps"
for program in $autostart; do
pidof -sx "$program" || "$program" &
done >/dev/null 2>&1
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval $(dbus-launch --exit-with-session --sh-syntax)
fi
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
export XSESSION_PID="$$"
exec dwm
'';
};
}

View File

@ -1,17 +1,17 @@
{ lib {
, config lib,
, ... config,
pkgs,
...
}: { }: {
imports = [ imports = [
../common ../wallpaper-changer/swww-wallpaper-changer
../common/wayland
./pyprland.nix
]; ];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
systemd = { systemd = {
variables = [ "--all" ]; variables = ["--all"];
enable = true; enable = true;
# Same as default, but stop graphical-session too # Same as default, but stop graphical-session too
extraCommands = lib.mkBefore [ extraCommands = lib.mkBefore [
@ -19,17 +19,13 @@
"systemctl --user start hyprland-session.target" "systemctl --user start hyprland-session.target"
]; ];
}; };
extraConfig = extraConfig = let
let monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString(m.width) }x${ toString(m.height) }@60,auto,1") config.monitors)}";
monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; in ''
active = "rgba(${config.colorScheme.colors.base08}ee)";
inactive = "rgba(${config.colorScheme.colors.base0C}ee)";
in
''
${monitor} ${monitor}
$terminal = alacritty $terminal = kitty
$fileManager = thunar $fileManager = dolphin
$menu = wofi --show drun $menu = wofi --show drun
env = XCURSOR_SIZE,24 env = XCURSOR_SIZE,24
@ -38,10 +34,11 @@
kb_layout = gb kb_layout = gb
kb_variant = kb_variant =
kb_model = kb_model =
kb_options = caps:swapescape
kb_rules = kb_rules =
repeat_delay = 280
repeat_rate = 60
follow_mouse = 1 follow_mouse = 1
touchpad { touchpad {
natural_scroll = no natural_scroll = no
} }
@ -50,18 +47,20 @@
general { general {
gaps_in = 10 gaps_in = 5
gaps_out = 10 gaps_out = 20
border_size = 2 border_size = 2
col.active_border = ${active} col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = ${inactive} col.inactive_border = rgba(595959aa)
layout = dwindle layout = dwindle
allow_tearing = false allow_tearing = false
} }
decoration { decoration {
rounding = 5 rounding = 10
blur { blur {
enabled = true enabled = true
@ -108,25 +107,22 @@
sensitivity = -0.5 sensitivity = -0.5
} }
windowrulev2 = float, class:floating
$mainMod = SUPER $mainMod = SUPER
bind = $mainMod, RETURN, exec, $terminal bind = $mainMod, Q, exec, $terminal
bind = $mainMod, Q, killactive, bind = $mainMod, C, killactive,
bind = $mainMod, M, exit, bind = $mainMod, M, exit,
bind = $mainMod, E, exec, $fileManager bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating, bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu bind = $mainMod, R, exec, $menu
bind = $mainMod, S, exec, rofi -show drun -show-icons
bind = $mainMod, y, exec, pypr toggle termy bind = $mainMod, left, movefocus, l
bind = $mainMod, u, exec, pypr toggle termu bind = $mainMod, right, movefocus, r
bind = $mainMod, i, exec, pypr toggle termi bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
bind = $mainMod, 1, workspace, 1 bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2 bind = $mainMod, 2, workspace, 2
@ -159,7 +155,7 @@
bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow bindm = $mainMod, mouse:273, resizewindow
exec-once=swww-wallpaper-changer & pypr exec-once=bash ~/.config/hypr/start.sh
''; '';
}; };
} }

View File

@ -1,33 +0,0 @@
{ ... }:
{
home.file.".config/hypr/pyprland.toml".text = ''
[pyprland]
plugins = [
"scratchpads"
]
[scratchpads.termy]
animation = "fromTop"
command = "$TERMINAL --class $TERMINAL-dropterm-y --title 'Scratchpad(y)'"
class = "$TERMINAL-dropterm-y"
size = "80% 80%"
[scratchpads.termu]
animation = "fromTop"
command = "$TERMINAL --class $TERMINAL-dropterm-u --title 'Scratchpad(u)'"
class = "$TERMINAL-dropterm-u"
size = "80% 80%"
[scratchpads.termi]
animation = "fromTop"
command = "$TERMINAL --class $TERMINAL-dropterm-i --title 'Scratchpad(i)'"
class = "$TERMINAL-dropterm-i"
size = "80% 80%"
[scratchpads.volume]
animation = "fromTop"
command = "pavucontrol --class floating"
class = "org.pulseaudio.pavucontrol"
size = "75% 60%"
'';
}

View File

@ -0,0 +1,36 @@
{
pkgs,
...
}:
{
systemd.user.services.wallpaper-changer = {
Unit = {
Description = "Script to change wallpaper using swww";
PartOf = [ "hyprland-session.target" ];
After = [ "hyprland-session.target" ]; # or "wayland.target", depending on your system setup
};
Install = {
WantedBy = [ "default.target" ];
};
Service = {
Type = [ "oneshot" ];
ExecStart = "${pkgs.writeShellScript "swww-wallpaper-changer" ''
export WAYLAND_DISPLAY="wayland-1"
wallpaper_dir="$HOME/.local/share/bg/"
# Allow some time for desktop to start
sleep 3
echo "starting daemon..."
${pkgs.swww}/bin/swww-daemon &
while true; do
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
${pkgs.swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60
[ $? != 0 ] && echo "swww failed, reloading daemon" && ${pkgs.swww}/bin/swww-daemon &
sleep 600
done
done
''}";
};
};
}

View File

@ -0,0 +1,16 @@
{
lib,
config,
pkgs,
...
}: {
# Let it try to start a few more times
systemd.user.services.waybar = {
Unit.StartLimitBurst = 30;
};
programs.waybar = {
enable = true;
#package = "";
systemd.enable = true;
};
}

View File

@ -0,0 +1,101 @@
{ pkgs, inputs, config, ... }:
let
user = config.home.username;
in
{
programs.firefox = {
enable = true;
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value= true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab"
DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
SearchBar = "unified"; # alternative: "separate"
/* ---- EXTENSIONS ---- */
# Check about:support for extension/add-on ID strings.
# Valid strings for installation_mode are "allowed", "blocked",
# "force_installed" and "normal_installed".
ExtensionSettings = {
"*".installation_mode = "blocked"; # blocks all addons except the ones specified below
# uBlock Origin:
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
# Privacy Badger:
"jid1-MnnxcxisBPnSXQ@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi";
installation_mode = "force_installed";
};
# Bitwarden
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
installation_mode = "force_installed";
};
# Dark Reader
"addon@darkreader.org" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
installation_mode = "force_installed";
};
# Sponser Block
"sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
installation_mode = "force_installed";
};
# Return Youtube Dislike
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/return-youtube-dislikes/latest.xpi";
installation_mode = "force_installed";
};
};
};
profiles.${user} = {
search.engines = {
"Searxng" = {
urls = [{
template = "http://10.0.10.35:8855";
}];
};
};
search.force = true;
bookmarks = [
{
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "bitlab21";
tags = [ "bitcoin" ];
keyword = "bitcoin";
url = "https://bitlab21.com";
}
];
settings = {
"dom.security.https_only_mode" = true;
"browser.download.panel.shown" = true;
"identity.fxaccounts.enabled" = false;
"signon.rememberSignons" = false;
};
};
};
}

View File

@ -1,13 +1,10 @@
{ pkgs, configVars, ... }: { pkgs, lib, config, ... }:
let
email = configVars.email.user;
in
{ {
programs.git = { programs.git = {
enable = true; enable = true;
package = pkgs.gitAndTools.gitFull; package = pkgs.gitAndTools.gitFull;
userName = "Sam"; userName = "Sam";
userEmail = "${email}"; userEmail = "samual.shop@proton.me";
aliases = { }; aliases = { };
extraConfig = { extraConfig = {
pull.rebase = false; pull.rebase = false;

View File

@ -1,18 +0,0 @@
{ 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

@ -1,9 +1,10 @@
{ inputs, config, ... }: { inputs, config, osConfig, ... }:
let let
secretsDirectory = builtins.toString inputs.nix-secrets; secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml"; secretsFile = "${secretsDirectory}/secrets.yaml";
homeDirectory = config.home.homeDirectory; homeDirectory = config.home.homeDirectory;
username = config.home.username; username = config.home.username;
hostname = osConfig.networking.hostName;
in in
{ {
imports = [ imports = [
@ -11,18 +12,11 @@ in
]; ];
sops = { sops = {
age = { age.sshKeyPaths = ["${homeDirectory}/.ssh/id_ed25519"];
sshKeyPaths = [ "${homeDirectory}/.ssh/id_ed25519" ];
generateKey = true;
keyFile = "/home/${username}/.config/sops/age/keys.txt";
};
defaultSopsFile = "${secretsFile}"; defaultSopsFile = "${secretsFile}";
validateSopsFiles = false; validateSopsFiles = false;
secrets."ssh_keys/deploy_key/id_ed25519" = {
secrets = {
"ssh_keys/deploy_key/id_ed25519" = {
path = "/home/${username}/.ssh/deploy_key-ssh-ed25519"; path = "/home/${username}/.ssh/deploy_key-ssh-ed25519";
}; };
}; };
};
} }

View File

@ -6,6 +6,22 @@ in
services = { services = {
syncthing = { syncthing = {
enable = true; enable = true;
# user = "${user}";
# dataDir = "/home/${user}/sync";
# configDir = "/home/${user}/.config/syncthing";
# overrideDevices = true; # overrides any devices added or deleted through the WebUI
# overrideFolders = true; # overrides any folders added or deleted through the WebUI
# settings = {
# devices = {
# "device1" = { id = "UT6263Y-V3GJXNO-6KIGAKZ-KY6UQMD-ER6BT4R-4LPKT2P-V4PCJYZ-ROJZIQQ"; };
# };
# folders = {
# "sync" = { # Name of folder in Syncthing, also the folder ID
# path = "/home/${user}/sync"; # Which folder to add to Syncthing
# devices = [ "device1" ]; # Which devices to share the folder with
# };
# };
# };
}; };
}; };
} }

View File

@ -1,53 +0,0 @@
{
config,
pkgs,
...
}: let
in {
systemd.user.services.transmission-daemon = {
Unit = {
Description = "Transmission Bittorrent Daemon";
Wants = "network-online.target";
After = "network-online.target";
Documentation = "man:transmission-daemon(1)";
};
Install = {
WantedBy = ["multi-user.target"];
};
Service = {
User = "transmission";
Type = "notify";
ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --log-level=error";
ExecReload = "${pkgs.coreutils}/bin/kill -s HUP $MAINPID";
CapabilityBoundingSet = "";
DevicePolicy = "closed";
KeyringMode = "private";
LockPersonality = "true";
NoNewPrivileges = "true";
MemoryDenyWriteExecute = "true";
PrivateTmp = "true";
PrivateDevices = "true";
ProtectClock = "true";
ProtectKernelLogs = "true";
ProtectControlGroups = "true";
ProtectKernelModules = "true";
ProtectSystem = "true";
ProtectHostname = "true";
ProtectKernelTunables = "true";
ProtectProc = "invisible";
RestrictNamespaces = "true";
RestrictSUIDSGID = "true";
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
RestrictRealtime = "true";
SystemCallFilter = "@system - service";
SystemCallArchitectures = "native";
SystemCallErrorNumber = "EPERM";
};
};
# home.file.".config/transmission-daemon/settings.json" = {
# recursive = true;
# text = ''
#
# '';
# };
}

View File

@ -1,120 +0,0 @@
{ 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"; }
];
};
};
};
}

18
home/fileserver.nix Normal file
View File

@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: {
imports = [
# Import users
./users/admin
./common/core
./common/optional/sops.nix
# Import optional
./common/optional/git.nix
];
}

33
home/nixdev.nix Normal file
View File

@ -0,0 +1,33 @@
{
pkgs,
config,
lib,
...
}: {
imports = [
# Import users
./users/sam
./common/core
./common/optional/desktop/hyprland
./common/optional/desktop/waybar.nix
./common/optional/sops.nix
# Import optional
./common/optional/git.nix
];
# ------
# | DP-1
# ------
monitors = [
{
name = "Virtual-1";
width = 2048;
height = 1152;
x = 0;
workspace = "1";
primary = true;
}
];
}

View File

@ -1,84 +0,0 @@
{
pkgs,
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
./common/optional/transmission.nix
];
home.packages = [
pkgs.qgis
];
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";
};
};
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,19 +1,20 @@
{ inputs {
, ... pkgs,
config,
lib,
...
}: { }: {
imports = [ imports = [
# Import users # Import users
./users/media ./users/media
./common/core ./common/core
./common/optional/sops.nix
./common/optional/firefox.nix
# Import optional # Import optional
./common/optional/git.nix ./common/optional/git.nix
./common/optional/syncthing.nix ./common/optional/syncthing.nix
./common/optional/desktop/cinnamon
./common/optional/desktop/common/kodi.nix
]; ];
colorScheme = inputs.nix-colors.colorSchemes.kanagawa;
} }

View File

@ -3,6 +3,7 @@
{ {
home.username = "admin"; home.username = "admin";
home.homeDirectory = "/home/admin"; home.homeDirectory = "/home/admin";
home.stateVersion = "23.11";
imports = [ imports = [
] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules?

View File

@ -3,6 +3,7 @@
{ {
home.username = "media"; home.username = "media";
home.homeDirectory = "/home/media"; home.homeDirectory = "/home/media";
home.stateVersion = "23.11";
imports = [ imports = [
inputs.impermanence.nixosModules.home-manager.impermanence inputs.impermanence.nixosModules.home-manager.impermanence
@ -12,7 +13,6 @@
enable = true; enable = true;
matchBlocks = { matchBlocks = {
"git.bitlab21.com" = { "git.bitlab21.com" = {
user = "git";
identitiesOnly = true; identitiesOnly = true;
identityFile = [ "~/.ssh/deploy_key-ssh-ed25519" ]; identityFile = [ "~/.ssh/deploy_key-ssh-ed25519" ];
}; };
@ -46,3 +46,4 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }

View File

@ -1,41 +1,62 @@
{outputs, ...}: { { config, pkgs, lib, outputs, ... }:
{
home.username = "sam"; home.username = "sam";
home.homeDirectory = "/home/sam"; home.homeDirectory = "/home/sam";
home.stateVersion = "23.11";
imports = imports = [
[ ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules?
]
++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? home.packages = [
pkgs.firefox
pkgs.kitty
pkgs.zathura
pkgs.xfce.thunar
#pkgs.age
];
home.file = {
".icons/bibata".source = "${pkgs.bibata-cursors}/share/icons/Bibata-Modern-Classic";
};
programs.ssh = { programs.ssh = {
enable = true; enable = true;
matchBlocks = { matchBlocks = {
"git.bitlab21.com" = { "git.bitlab21.com" = {
identitiesOnly = true; identitiesOnly = true;
identityFile = ["~/.ssh/id_ed25519"]; identityFile = [ "~/.ssh/id_ed25519"];
}; };
}; };
}; };
xdg.userDirs = { home.sessionPath = [
enable = true; ];
createDirectories = true;
desktop = null; gtk.enable = true;
documents = "/home/sam/docs";
download = "/home/sam/dl"; gtk.cursorTheme.package = pkgs.bibata-cursors;
music = "/home/sam/mus"; gtk.cursorTheme.name = "Bibata-Modern-Ice";
pictures = "/home/sam/pics";
publicShare = "/home/sam/sync"; gtk.theme.package = pkgs.gruvbox-gtk-theme;
templates = null; gtk.theme.name = "Gruvbox-Dark-B";
videos = "/home/sam/vids";
}; gtk.iconTheme.package = pkgs.gruvbox-plus-icons;
gtk.iconTheme.name = "GruvboxPlus";
qt.enable = true;
qt.platformTheme.name = "gtk";
qt.style.name = "adwaita-dark";
qt.style.package = pkgs.adwaita-qt;
home.sessionVariables = { home.sessionVariables = {
EDITOR = "nvim"; EDITOR="nvim";
TERMINAL = "st"; MUSIC="$HOME/mus/music_data/";
READER = "zathura"; TERMINAL="kitty";
IMAGE_VIEWER = "nsxiv"; READER="zathura";
IMAGE_EDITOR = "drawing"; IMAGE_VIEWER="";
PATH = "$PATH:$HOME/.scripts"; IMAGE_EDITOR="";
}; };
} }

View File

@ -3,28 +3,17 @@ let
pubKeys = lib.filesystem.listFilesRecursive (../common/users/keys); pubKeys = lib.filesystem.listFilesRecursive (../common/users/keys);
secretsDirectory = builtins.toString inputs.nix-secrets; secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml"; secretsFile = "${secretsDirectory}/secrets.yaml";
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/root".path;
hasOptinPersistence = config.environment.persistence ? "/persist";
# Disko setup
fsType = "btrfs";
dev = "/dev/vda";
encrypted = true;
btrfsMountDevice = if encrypted then "/dev/mapper/crypted" else "/dev/root_vg/root";
in in
{ {
imports = imports =
[ [
# Disk configuration # Disk configuration
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
# Disk configuration
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
(import ../common/disks { device = dev; fsType = fsType; encrypted = encrypted; }) (import ../common/disks/luks-btrfs-subvolumes.nix { device = "/dev/vda" ; })
#(import ../common/disks/std-disk-config.nix { device = "/dev/vda" ; })
# Impermanence ../common/optional/btrfs-impermanence.nix
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
(import ../common/disks/btrfs-impermanence.nix { btrfsMountDevice = btrfsMountDevice; lib = lib; })
# Import core options # Import core options
./hardware-configuration.nix ./hardware-configuration.nix
@ -50,9 +39,11 @@ in
files = [ files = [
"/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub" "/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/deploy_key-ssh-ed25519"
]; ];
}; };
i18n.defaultLocale = "en_GB.UTF-8"; i18n.defaultLocale = "en_GB.UTF-8";
console = { console = {
font = "Lat2-Terminus16"; font = "Lat2-Terminus16";
@ -73,7 +64,7 @@ in
mutableUsers = true; mutableUsers = true;
extraUsers = { extraUsers = {
root = { root = {
hashedPasswordFile = sopsHashedPasswordFile; initialPassword = "1234";
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key); openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
}; };
}; };
@ -90,7 +81,7 @@ in
validateSopsFiles = false; validateSopsFiles = false;
age = { age = {
sshKeyPaths = [ "${lib.optionalString hasOptinPersistence "/persist"}/etc/ssh/ssh_host_ed25519_key" ]; sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
}; };
secrets = { secrets = {
"passwords/root".neededForUsers = true; "passwords/root".neededForUsers = true;
@ -113,7 +104,7 @@ in
ports = [22]; ports = [22];
authorizedKeysFiles = lib.mkForce ["/etc/ssh/authorized_keys.d/%u"]; authorizedKeysFiles = lib.mkForce ["/etc/ssh/authorized_keys.d/%u"];
hostKeys = [{ hostKeys = [{
path = "${lib.optionalString hasOptinPersistence "/persist"}/persist/etc/ssh/ssh_host_ed25519_key"; path = "/persist/etc/ssh/ssh_host_ed25519_key";
type = "ed25519"; type = "ed25519";
}]; }];
settings = { settings = {
@ -143,4 +134,5 @@ in
}; };
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
system.stateVersion = "23.11";
} }

View File

@ -1,202 +0,0 @@
{
inputs,
lib,
pkgs,
config,
configVars,
...
}: 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;
pieholeIp = configVars.networking.addresses.piehole.ip;
gatewayIp = configVars.networking.addresses.gateway.ip;
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
../common/optional/nix-ld.nix
../common/optional/gaming.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;
};
};
swapDevices = [
{
device = "/.swapvol/swapfile";
size = 32 * 1024;
}
];
services = {
libinput.touchpad.accelSpeed = "0.5";
xserver = {
xkb.options = "caps:swapescape";
dpi = 196;
upscaleDefaultCursor = true;
# FIXME this doesnt work for some reason
# displayManager.sessionCommands = pkgs.writeShellScriptBin "key-remaps" ''
# ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch"
# ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H"
# ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J"
# ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K"
# ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L"
# '';
};
};
# fix cpu throttling on Lenovo Thinkpad
# see: https://github.com/erpalma/throttled
services.throttled.enable = 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
];
};
# nvidia
hardware.opengl = {
enable = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
nvidiaPersistenced = true;
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
# FIXME issue with stable nvidia driver and latest linux kernel
# use mkDriver to specify newer nvidia driver that is compatible
# see: https://github.com/NixOS/nixpkgs/issues/341844#issuecomment-2351075413
# and https://discourse.nixos.org/t/builder-for-nvidia-x11-550-78-6-10-drv-failed-with-exit-code-2/49360/32
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "555.58.02";
sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM=";
sha256_aarch64 = "sha256-wb20isMrRg8PeQBU96lWJzBMkjfySAUaqt4EgZnhyF8=";
openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY=";
settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8=";
persistencedSha256 = "sha256-a1D7ZZmcKFWfPjjH1REqPM5j/YLWKnbkP9qfRyIyxAw=";
};
};
# https://bbs.archlinux.org/viewtopic.php?id=297276 for NVreg_EnableGpuFirmware fix
# https://discourse.nixos.org/t/how-to-use-nvidia-prime-offload-to-run-the-x-server-on-the-integrated-board/9091/15
# for udev rules to disable dGPU when not in use
boot.extraModprobeConfig = ''
options nvidia NVreg_DynamicPowerManagement=0x02
options nvidia NVreg_EnableGpuFirmware=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{remove}="1"
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="bind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="auto"
# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", TEST=="power/control", ATTR{power/control}="on"
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"
'';
networking = {
hostName = "citadel";
networkmanager.enable = true;
enableIPv6 = false;
nameservers = ["${pieholeIp}" "${gatewayIp}" "8.8.8.8"];
};
services.libinput.enable = true;
}

View File

@ -1,24 +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 = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# 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,12 +1,12 @@
{ pkgs, lib, inputs, config, outputs, ... }: { pkgs, lib, inputs, config, outputs, ...}:
let let
sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/root".path; sopsHashedPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."passwords/root".path;
in in
{ {
imports = [ imports = [
inputs.impermanence.nixosModules.impermanence
./sops.nix ./sops.nix
./locale.nix ./locale.nix
inputs.impermanence.nixosModules.impermanence
]; ];
nixpkgs = { nixpkgs = {
@ -14,7 +14,6 @@ in
outputs.overlays.additions outputs.overlays.additions
outputs.overlays.modifications outputs.overlays.modifications
outputs.overlays.unstable-packages outputs.overlays.unstable-packages
inputs.nur.overlay
]; ];
config = { config = {
allowUnfree = true; allowUnfree = true;
@ -37,20 +36,12 @@ in
}; };
}; };
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
environment.systemPackages = [ environment.systemPackages = [
pkgs.rsync pkgs.rsync
pkgs.curl pkgs.curl
pkgs.just pkgs.just
pkgs.git pkgs.git
pkgs.vim pkgs.vim
pkgs.linuxKernel.packages.linux_zen.cpupower
]; ];
system.stateVersion = "24.05";
} }

View File

@ -1,13 +1,13 @@
{ { pkgs, lib, inputs, config, ... }:
lib,
inputs, let
config,
...
}: let
secretsDirectory = builtins.toString inputs.nix-secrets; secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml"; secretsFile = "${secretsDirectory}/secrets.yaml";
hasOptinPersistence = config.environment.persistence ? "/persist"; hasOptinPersistence = config.environment.persistence ? "/persist";
in { hostname = config.networking.hostName;
in
{
imports = [ imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
@ -17,7 +17,7 @@ in {
validateSopsFiles = false; validateSopsFiles = false;
age = { age = {
sshKeyPaths = ["${lib.optionalString hasOptinPersistence "/persist"}/etc/ssh/ssh_host_ed25519_key"]; sshKeyPaths = [ "${lib.optionalString hasOptinPersistence "/persist"}/etc/ssh/ssh_host_ed25519_key" ];
}; };
secrets = { secrets = {
"passwords/root".neededForUsers = true; "passwords/root".neededForUsers = true;

View File

@ -1,25 +0,0 @@
{
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
};
"/persist" = {
mountOptions = [ "subvol=persist" ];
mountpoint = "/persist";
};
"/nix" = {
mountOptions = [ "subvol=nix" "noatime" ];
mountpoint = "/nix";
};
"/swap" = {
mountOptions = [ "noatime" ];
mountpoint = "/.swapvol";
swap.swapfile.size = "8192M";
};
};
}

View File

@ -1,21 +0,0 @@
{
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/nix" = {
mountOptions = [ "subvol=nix" "noatime" ];
mountpoint = "/nix";
};
"/swap" = {
mountOptions = [ "noatime" ];
mountpoint = "/.swapvol";
swap.swapfile.size = "8192M";
};
};
}

View File

@ -1,11 +0,0 @@
{ device, fsType, encrypted, impermanence, ... }:
let
fsModule = if impermanence then ./${fsType}/persist.nix else ./${fsType}/standard.nix;
basic = import ./${fsType}/basic.nix { inherit device; };
lvm = import ./lvm.nix { inherit device; fsModule = fsModule; };
luks = import ./luks.nix { inherit device; fsModule = fsModule; };
in
if fsType == "ext4" then basic
else if fsType == "btrfs" && encrypted then luks
else if fsType == "btrfs" then lvm
else null

View File

@ -3,7 +3,7 @@
disko.devices = { disko.devices = {
disk = { disk = {
vda = { vda = {
inherit device; device = "/dev/vda";
type = "disk"; type = "disk";
content = { content = {
type = "gpt"; type = "gpt";

View File

@ -0,0 +1,66 @@
{device ? throw "Must define a device, e.g. /dev/sda"}:
{
disko.devices = {
disk = {
vdb = {
type = "disk";
inherit device;
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
# disable settings.keyFile if you want to use interactive password entry
passwordFile = "/tmp/luks_secret.key"; # Interactive
# settings = {
# allowDiscards = true;
# keyFile = "${sopsHashedPasswordFile}";
# };
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
};
"/persist" = {
mountOptions = [ "subvol=persist" ];
mountpoint = "/persist";
};
"/nix" = {
mountOptions = [ "subvol=nix" "noatime" ];
mountpoint = "/nix";
};
"/swap" = {
mountOptions = [ "noatime" ];
mountpoint = "/.swapvol";
swap.swapfile.size = "8192M";
};
};
};
};
};
};
};
};
};
};
}

View File

@ -1,40 +0,0 @@
{
device ? throw "Must define a device, e.g. /dev/sda",
fsModule ? "Must specify submodule"
}:
{
disko.devices = {
disk = {
vdb = {
type = "disk";
inherit device;
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
passwordFile = "/tmp/luks_secret.key"; # Interactive
content = (import "${fsModule}");
};
};
};
};
};
};
};
}

View File

@ -1,48 +0,0 @@
{
device ? throw "Must define a device, e.g. /dev/sda",
fsModule ? "Must specify submodule"
}:
{
disko.devices = {
disk.main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "root_vg";
};
};
};
};
};
lvm_vg = {
root_vg = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = (import "${fsModule}");
};
};
};
};
};
}

View File

@ -0,0 +1,69 @@
{device ? throw "Must define a device, e.g. /dev/sda"}:
{
disko.devices = {
disk.main = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "root_vg";
};
};
};
};
};
lvm_vg = {
root_vg = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
};
"/persist" = {
mountOptions = [ "subvol=persist" ];
mountpoint = "/persist";
};
"/nix" = {
mountOptions = [ "subvol=nix" "noatime" ];
mountpoint = "/nix";
};
"/swap" = {
mountOptions = [ "noatime" ];
mountpoint = "/.swapvol";
swap.swapfile.size = "8192M";
};
};
};
};
};
};
};
};
}

Some files were not shown because too many files have changed in this diff Show More