summaryrefslogtreecommitdiff
path: root/examples/nixos/flake.nix
diff options
context:
space:
mode:
authorStefan Kreutz <mail@skreutz.com>2026-04-16 02:22:41 +0200
committerStefan Kreutz <mail@skreutz.com>2026-04-16 02:22:41 +0200
commit16e0d7281e12dc672ae77de4c9328c33d6cd7074 (patch)
tree0954f658b848e2f564f210952811488a3023494a /examples/nixos/flake.nix
parentd07eaac0131f81db0dbacfbdae211e89254e2a05 (diff)
downloadtemp-postgres-16e0d7281e12dc672ae77de4c9328c33d6cd7074.tar.gz
Add NixOS config example
Diffstat (limited to 'examples/nixos/flake.nix')
-rw-r--r--examples/nixos/flake.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/examples/nixos/flake.nix b/examples/nixos/flake.nix
new file mode 100644
index 0000000..f97422c
--- /dev/null
+++ b/examples/nixos/flake.nix
@@ -0,0 +1,51 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ temp-postgres = {
+ # Try adding "?ref=main&shallow=0" to the URL if you experience caching issues.
+ url = "git+https://git.skreutz.com/temp-postgres.git";
+ # Optionally use your global Nixpkgs input.
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ temp-postgres,
+ }@inputs:
+ {
+ nixosConfigurations.myhost =
+ let
+ system = "x86_64-linux";
+ in
+ nixpkgs.lib.nixosSystem {
+ inherit system;
+ specialArgs = {
+ inherit system inputs;
+ };
+ modules = [
+ # The following goes typically into ./configuration.nix
+ {
+ environment.systemPackages = [ inputs.temp-postgres.packages.${system}.default ];
+
+ users.users.stefan = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" ];
+ initialPassword = "sesame";
+ };
+ system.stateVersion = "26.05";
+
+ # Dummy values to avoid failed assertions during `nix flake check`.
+ fileSystems."/" = {
+ device = "/dev/null";
+ fsType = "ext4";
+ };
+ boot.loader.grub.devices = [ "/dev/null" ];
+ }
+ ];
+ };
+ };
+}
Generated by cgit. See skreutz.com for my tech blog and contact information.