From 22736986f6a2291896d3512b81391afda29ddabd Mon Sep 17 00:00:00 2001 From: Dennis Frieberg Date: Mon, 12 Jun 2023 08:34:47 +0200 Subject: [PATCH] initial flake structure --- flake-module.nix | 25 ++++++++ flake.lock | 132 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 17 ++++++ nixos/flake-module.nix | 16 +++++ nixos/machines/.gitkeep | 0 5 files changed, 190 insertions(+) create mode 100644 flake-module.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nixos/flake-module.nix create mode 100644 nixos/machines/.gitkeep diff --git a/flake-module.nix b/flake-module.nix new file mode 100644 index 0000000..589de49 --- /dev/null +++ b/flake-module.nix @@ -0,0 +1,25 @@ +{inputs, ...}: +{ + debug = true; + imports = [ ./nixos/flake-module.nix + # To import a flake module + # 1. Add foo to inputs + # 2. Add foo as a parameter to the outputs function + # 3. Add here: foo.flakeModule + + ]; + systems = [ "x86_64-linux"]; +# perSystem = { config, self', inputs', pkgs, system, ... }: { + # Per-system attributes can be defined here. The self' and inputs' + # module parameters provide easy access to attributes of the same + # system. + + # Equivalent to inputs'.nixpkgs.legacyPackages.hello; +# }; +# flake = { + # The usual flake attributes can be defined here, including system- + # agnostic ones like nixosModule and system-enumerating ones, although + # those are more easily expressed in perSystem. + +# }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4f71017 --- /dev/null +++ b/flake.lock @@ -0,0 +1,132 @@ +{ + "nodes": { + "blobs": { + "flake": false, + "locked": { + "lastModified": 1604995301, + "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "type": "gitlab" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "nixos-mailserver": { + "inputs": { + "blobs": "blobs", + "flake-compat": [], + "nixpkgs": [], + "nixpkgs-22_11": "nixpkgs-22_11", + "utils": "utils" + }, + "locked": { + "lastModified": 1686468558, + "narHash": "sha256-K69Ojlx3N8I6tRTZsrKFMIqK4yrnJ6/PjfKZi3wchYg=", + "ref": "refs/heads/master", + "rev": "290d00f6db4e80467013728819ad73dd4a394d9a", + "revCount": 554, + "type": "git", + "url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git" + }, + "original": { + "type": "git", + "url": "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1686412476, + "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "21951114383770f96ae528d0ae68824557768e81", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-22_11": { + "locked": { + "lastModified": 1669558522, + "narHash": "sha256-yqxn+wOiPqe6cxzOo4leeJOp1bXE/fjPEi/3F/bBHv8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ce5fe99df1f15a09a91a86be9738d68fadfbad82", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-22.11", + "type": "indirect" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixos-mailserver": "nixos-mailserver", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1605370193, + "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5021eac20303a61fafe17224c087f5519baed54d", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d2c7384 --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "Description for the project"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixos-mailserver = { + url = "git+https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git"; + inputs = { + flake-compat.follows = ""; + nixpkgs.follows = ""; + }; + }; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } (import ./flake-module.nix); +} diff --git a/nixos/flake-module.nix b/nixos/flake-module.nix new file mode 100644 index 0000000..3e5a6cc --- /dev/null +++ b/nixos/flake-module.nix @@ -0,0 +1,16 @@ +# copied and adopted from maralorns config +{ withSystem, lib, inputs, ... }: { + flake = { + nixosConfigurations = withSystem "x86_64-linux" ({ pkgs, ... }: + let + machines = builtins.attrNames (builtins.readDir ./machines); + makeSystem = name: + pkgs.nixos { + imports = [ + (import (./. + "/machines/${name}/configuration.nix") inputs) + # inputs.secrets.nixosModules.default + ]; + }; + in lib.genAttrs machines makeSystem); + }; +} diff --git a/nixos/machines/.gitkeep b/nixos/machines/.gitkeep new file mode 100644 index 0000000..e69de29