From 8cf35f5d7ffb071cc9ff59a306093aaf5dc3b1d2 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Mon, 4 Mar 2024 01:30:20 +0000 Subject: [PATCH] Add basic structure --- flake.lock | 146 ++++++++++++++++++++++++++++++++++ flake.nix | 44 ++++++++++ system/pearbutter/default.nix | 27 +++++++ 3 files changed, 217 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 system/pearbutter/default.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2ff33ee --- /dev/null +++ b/flake.lock @@ -0,0 +1,146 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "libgit2": { + "flake": false, + "locked": { + "lastModified": 1697646580, + "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "type": "github" + }, + "original": { + "owner": "libgit2", + "repo": "libgit2", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": "flake-compat", + "libgit2": "libgit2", + "nixpkgs": [ + "nixbsd", + "nixpkgs" + ], + "nixpkgs-regression": [ + "nixbsd", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709342329, + "narHash": "sha256-w5zDczFSMizXBsTQPRsw1P9r4rxUIR4/F2jtfn6A1kQ=", + "owner": "rhelmot", + "repo": "nix", + "rev": "397df537c8273ee539ea79183d59ea40543326d2", + "type": "github" + }, + "original": { + "owner": "rhelmot", + "ref": "freebsd-staging", + "repo": "nix", + "type": "github" + } + }, + "nixbsd": { + "inputs": { + "nix": "nix", + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "utils" + ] + }, + "locked": { + "lastModified": 1709511912, + "narHash": "sha256-rl402dqlZ/qyLgwVapltywaailCoozJrYof/mpvuoMA=", + "owner": "nixos-bsd", + "repo": "nixbsd", + "rev": "3113ca2e05b61f1f604eb31317f178f1e3c211d0", + "type": "github" + }, + "original": { + "owner": "nixos-bsd", + "repo": "nixbsd", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709510700, + "narHash": "sha256-poLXsTCfU2srsxR7E97/l0s2jX0ZE4B9kQRKgN1te9I=", + "owner": "rhelmot", + "repo": "nixpkgs", + "rev": "de40a2dd2a76e912b8f226878f5c312b82ca1aac", + "type": "github" + }, + "original": { + "owner": "rhelmot", + "ref": "freebsd-staging", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixbsd": "nixbsd", + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "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..3c91c79 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + inputs = { + nixpkgs.url = "github:rhelmot/nixpkgs/freebsd-staging"; + utils.url = "github:numtide/flake-utils"; + nixbsd = { + url = "github:nixos-bsd/nixbsd"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "utils"; + }; + }; + + outputs = + { + nixpkgs, + nixbsd, + utils, + ... + }: + let + baseDir = ./system; + makeSystem = module: nixbsd.nixbsdSystem { modules = [ module ]; }; + in + { + nixosConfigurations = nixpkgs.lib.mapAttrs (name: _: makeSystem (baseDir + "/${name}")) ( + builtins.readDir baseDir + ); + } + // + utils.lib.eachSystem + [ + "aarch64-linux" + "x86_64-linux" + "x86_64-freebsd" + ] + ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + formatter = pkgs.nixfmt-rfc-style; + } + ); +} diff --git a/system/pearbutter/default.nix b/system/pearbutter/default.nix new file mode 100644 index 0000000..5ba1945 --- /dev/null +++ b/system/pearbutter/default.nix @@ -0,0 +1,27 @@ +{ ... }: +{ + nixpkgs.hostPlatform = "x86_64-freebsd"; + nixpkgs.config.freebsdBranch = "releng/14.0"; + + networking.hostName = "pearbutter"; + + users.users.artemis = { + isNormalUser = true; + description = "Artemis Tosini"; + extraGroups = [ "wheel" ]; + initialPassrod = "toor"; + }; + + services.sshd.enable = true; + boot.loader.stand.enable = true; + + fileSystems."/" = { + device = "/dev/ufs/pearbutter-root"; + fsType = "ufs"; + }; + + fileSystems."/boot" = { + device = "/dev/msdosfs/pearbutter-esp"; + fsType = "msdosfs"; + }; +}