From be2bb504d9d51dc2c452511ea31a31808b8b8b37 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 20 Nov 2022 17:23:58 +0200 Subject: [PATCH] feat(config): initial Based on `https://github.com/Misterio77/nix-starter-configs/tree/cce47e4df5225d83a61b56c209f8cdb2fbc26ace/standard` Adds (experimental) support for `nix-on-droid` and `nix-on-darwin` Includes support for multiple hosts of each base Adds config for `cheetah` on `nix-on-droid` --- LICENSE | 21 ++ flake.lock | 262 ++++++++++++++++++++++++ flake.nix | 131 ++++++++++++ home-manager/djam/home.nix | 62 ++++++ modules/home-manager/default.nix | 7 + modules/nix-darwin/default.nix | 7 + modules/nix-on-droid/default.nix | 7 + modules/nixos/default.nix | 7 + nix-darwin/apavel-a01/configuration.nix | 0 nix-on-droid/cheetah/configuration.nix | 31 +++ nix-on-droid/cheetah/home.nix | 113 ++++++++++ nixos/arthur/configuration.nix | 99 +++++++++ nixos/arthur/hardware-configuration.nix | 10 + nixpkgs.nix | 8 + overlays/default.nix | 14 ++ pkgs/default.nix | 6 + shell.nix | 10 + 17 files changed, 795 insertions(+) create mode 100644 LICENSE create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home-manager/djam/home.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/nix-darwin/default.nix create mode 100644 modules/nix-on-droid/default.nix create mode 100644 modules/nixos/default.nix create mode 100644 nix-darwin/apavel-a01/configuration.nix create mode 100644 nix-on-droid/cheetah/configuration.nix create mode 100644 nix-on-droid/cheetah/home.nix create mode 100644 nixos/arthur/configuration.nix create mode 100644 nixos/arthur/hardware-configuration.nix create mode 100644 nixpkgs.nix create mode 100644 overlays/default.nix create mode 100644 pkgs/default.nix create mode 100644 shell.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..be46d22 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Pavel Atanasov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8129c7e --- /dev/null +++ b/flake.lock @@ -0,0 +1,262 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667907331, + "narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6639e3a837fc5deb6f99554072789724997bc8e5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-22.05", + "repo": "home-manager", + "type": "github" + } + }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1668865307, + "narHash": "sha256-Fwoalxq8UzocDeK5LIlAOT/JglG8SeGtH6yvvzHh/uU=", + "owner": "neovim", + "repo": "neovim", + "rev": "6e8ed5abaa9c33d1d78ab7ff5b07dd5bac623a1d", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "neovim-flake": "neovim-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1668932129, + "narHash": "sha256-DcGSEgs+q+JRQwrxdasedbMkYZ9g5jxkekd+td+dXxs=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "543d1ddb6231aef08e4ce063d72d0822b9b60598", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "nix-formatter-pack": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs" + ], + "nmd": "nmd", + "nmt": "nmt" + }, + "locked": { + "lastModified": 1666720474, + "narHash": "sha256-iWojjDS1D19zpeZXbBdjWb9MiKmVVFQCqtJmtTXgPx8=", + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "rev": "14876cc8fe94a3d329964ecb073b4c988c7b61f5", + "type": "github" + }, + "original": { + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "type": "github" + } + }, + "nix-on-droid": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nix-formatter-pack": "nix-formatter-pack", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap" + }, + "locked": { + "lastModified": 1667935792, + "narHash": "sha256-xdTToQCBJFhslIsIOIjBFyVSiESLht5B5UjCjk99scY=", + "owner": "t184256", + "repo": "nix-on-droid", + "rev": "27c206f57ac7c6434b53032d3625fd5cb73bb325", + "type": "github" + }, + "original": { + "owner": "t184256", + "ref": "master", + "repo": "nix-on-droid", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1668765800, + "narHash": "sha256-rC40+/W6Hio7b/RsY8SvQPKNx4WqNcTgfYv8cUMAvJk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "52b2ac8ae18bbad4374ff0dd5aeee0fdf1aea739", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-for-bootstrap": { + "locked": { + "lastModified": 1656265786, + "narHash": "sha256-A9RkoGrxzsmMm0vily18p92Rasb+MbdDMaSnzmywXKw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cd90e773eae83ba7733d2377b6cdf84d45558780", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cd90e773eae83ba7733d2377b6cdf84d45558780", + "type": "github" + } + }, + "nmd": { + "flake": false, + "locked": { + "lastModified": 1666190571, + "narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=", + "owner": "rycee", + "repo": "nmd", + "rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmd", + "type": "gitlab" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1648075362, + "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", + "owner": "rycee", + "repo": "nmt", + "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmt", + "type": "gitlab" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-on-droid": "nix-on-droid", + "nixpkgs": "nixpkgs", + "zig-overlay": "zig-overlay" + } + }, + "zig-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1668946066, + "narHash": "sha256-L+PjXE1lRbmlj4Aw6x9iapuYGbre0qQzjlydXTU2CGs=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "7bc303b90bd490aa92d3820c4404ddc1c3b9c557", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..992aae6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,131 @@ +{ + description = "reo101's NixOS, nix-on-droid and nix-on-darwin configs"; + + inputs = { + # Nixpkgs + nixpkgs = { + # url = "github:nixos/nixpkgs/nixos-22.05"; + url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + # Nix on Droid + nix-on-droid = { + # url = "github:t184256/nix-on-droid/release-22.05"; + url = "github:t184256/nix-on-droid/master"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + + # Home Manager + home-manager = { + url = "github:nix-community/home-manager/release-22.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # hardware = { + # url = "github:nixos/nixos-hardware"; + # }; + + # nix-colors = { + # url = "github:misterio77/nix-colors"; + # }; + + neovim-nightly-overlay = { + url = "github:nix-community/neovim-nightly-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zig-overlay = { + url = "github:mitchellh/zig-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self + , nixpkgs + , nix-on-droid + , home-manager + # , hardware + # , nix-colors + , neovim-nightly-overlay + , zig-overlay + , ... + } @ inputs: + let + # inherit (self) outputs; + # forAllSystems = nixpkgs.lib.genAttrs [ + # "aarch64-linux" + # "i686-linux" + # "x86_64-linux" + # "aarch64-darwin" + # "x86_64-darwin" + # ]; + in + rec { + # packages = forAllSystems (system: + # let pkgs = nixpkgs.legacyPackages.${system}; + # in import ./pkgs { inherit pkgs; } + # ); + + # devShells = forAllSystems (system: + # let pkgs = nixpkgs.legacyPackages.${system}; + # in import ./shell.nix { inherit pkgs; } + # ); + + overlays = import ./overlays; + nixosModules = import ./modules/nixos; + nixOnDroidModules = import ./modules/nix-on-droid; + nixDarwinModules = import ./modules/nix-darwin; + homeManagerModules = import ./modules/home-manager; + + nixosConfigurations = { + # arthur = nixpkgs.lib.nixosSystem { + # specialArgs = { inherit inputs outputs; }; + # modules = [ + # ./nixos/arthur/configuration.nix + # ]; + # }; + }; + + nixOnDroidConfigurations = + let mkHost = system: hostname: nix-on-droid.lib.nixOnDroidConfiguration { + # pkgs = legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + + overlays = [ + nix-on-droid.overlays.default + ]; + }; + + modules = [ + ./nix-on-droid/${hostname}/configuration.nix + { nix.registry.nixpkgs.flake = nixpkgs; } + ] ++ (builtins.attrValues nixOnDroidModules); + + extraSpecialArgs = { + inherit inputs; + # inherit outputs; + # inherit inputs outputs; + # rootPath = ./.; + }; + + home-manager-path = home-manager.outPath; + }; + in rec { + cheetah = mkHost "aarch64-linux" "cheetah"; + + default = cheetah; + }; + + homeConfigurations = { + # "nix-on-droid@cheetah" = home-manager.lib.homeManagerConfiguration { + # pkgs = nixpkgs.legacyPackages.x86_64-linux; + # extraSpecialArgs = { inherit inputs outputs; }; + # modules = [ + # ./home-manager/home.nix + # ]; + # }; + }; + }; +} diff --git a/home-manager/djam/home.nix b/home-manager/djam/home.nix new file mode 100644 index 0000000..fbb947d --- /dev/null +++ b/home-manager/djam/home.nix @@ -0,0 +1,62 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) + +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + ./nvim.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = (_: true); + }; + }; + + # TODO: Set your username + home = { + username = "your-username"; + homeDirectory = "/home/your-username"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "22.05"; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..e41f7d9 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,7 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nix-darwin/default.nix b/modules/nix-darwin/default.nix new file mode 100644 index 0000000..92d47e5 --- /dev/null +++ b/modules/nix-darwin/default.nix @@ -0,0 +1,7 @@ +# Add your reusable nix-on-darwin modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nix-on-droid/default.nix b/modules/nix-on-droid/default.nix new file mode 100644 index 0000000..bf1c581 --- /dev/null +++ b/modules/nix-on-droid/default.nix @@ -0,0 +1,7 @@ +# Add your reusable nix-on-droid modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..bec6184 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,7 @@ +# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. + +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/nix-darwin/apavel-a01/configuration.nix b/nix-darwin/apavel-a01/configuration.nix new file mode 100644 index 0000000..e69de29 diff --git a/nix-on-droid/cheetah/configuration.nix b/nix-on-droid/cheetah/configuration.nix new file mode 100644 index 0000000..6aa118d --- /dev/null +++ b/nix-on-droid/cheetah/configuration.nix @@ -0,0 +1,31 @@ +{ inputs, outputs, lib, config, pkgs, ... }: + +{ + environment.packages = with pkgs; []; + + # Backup etc files instead of failing to activate generation if a file already exists in /etc + environment.etcBackupExtension = ".bak"; + + # Remove motd + environment.motd = null; + + # # Set $EDITOR + # environment.variables.EDITOR = "nvim"; + + # Read the changelog before changing this value + system.stateVersion = "22.05"; + + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + time.timeZone = "Europe/Sofia"; + + home-manager = { + config = ./home.nix; + backupFileExtension = "hm-bak"; + useGlobalPkgs = true; + + # extraOptions = { inherit inputs; }; + }; +} diff --git a/nix-on-droid/cheetah/home.nix b/nix-on-droid/cheetah/home.nix new file mode 100644 index 0000000..6568402 --- /dev/null +++ b/nix-on-droid/cheetah/home.nix @@ -0,0 +1,113 @@ +{ inputs ? {}, outputs ? {}, lib, config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home = { + username = "nix-on-droid"; + # username = "reo101"; + homeDirectory = "/data/data/com.termux.nix/files/home"; + stateVersion = "22.05"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + # neovim + # clang + gcc + + diffutils + findutils + utillinux + tzdata + hostname + man + ncurses + gnugrep + gnupg + gnused + gnutar + bzip2 + gzip + xz + zip + unzip + + # Bling + onefetch + neofetch + + # Utils + ripgrep + + # Passwords + pass + passExtensions.pass-otp + + # Dhall + dhall + dhall-lsp-server + ]; + + # nixpkgs = { + # overlays = [ + # inputs.neovim-nightly-overlay.overlay + # inputs.zig-overlay.overlay + # ]; + # + # config.allowUnfree = true; + # }; + + # programs.zig = { + # enable = true; + # package = pkgs.zig; + # }; + + programs.neovim = { + enable = true; + # package = neovim-nightly-overlay.neovim-nightly; + # package = pkgs.neovim-nightly; + # defaultEditor = true; + + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + withPython3 = false; + withNodeJs = false; + withRuby = false; + + # neovimRcContent = ""; + + extraPackages = with pkgs; [ + tree-sitter + rnix-lsp + # sumneko-lua-language-server + # stylua + # texlab + # rust-analyzer + ]; + }; + + home.file = { + ".config/nvim" = { + recursive = true; + source = /data/data/com.termux.nix/files/home/.local/src/reovim; + }; + }; + + programs.git = { + enable = true; + userName = "reo101"; + # userName = "Pavel Atanasov"; + userEmail = "pavel.atanasov2001@gmail.com"; + }; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; +} diff --git a/nixos/arthur/configuration.nix b/nixos/arthur/configuration.nix new file mode 100644 index 0000000..7db9279 --- /dev/null +++ b/nixos/arthur/configuration.nix @@ -0,0 +1,99 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) + +{ inputs, outputs, lib, config, pkgs, ... }: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # If you want to use overlays your own flake exports (from overlays dir): + # outputs.overlays.modifications + # outputs.overlays.additions + + # Or overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + nix = { + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + }; + + # FIXME: Add the rest of your current configuration + + # TODO: Set your hostname + networking.hostName = "your-hostname"; + + # TODO: This is just an example, be sure to use whatever bootloader you prefer + boot.loader.systemd-boot.enable = true; + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + # FIXME: Replace with your username + your-username = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + # initialPassword = "correcthorsebatterystaple"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = [ "wheel" ]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + # Forbid root login through SSH. + permitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + passwordAuthentication = false; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "22.05"; +} diff --git a/nixos/arthur/hardware-configuration.nix b/nixos/arthur/hardware-configuration.nix new file mode 100644 index 0000000..dd00939 --- /dev/null +++ b/nixos/arthur/hardware-configuration.nix @@ -0,0 +1,10 @@ +# This is just an example, you should generate yours with nixos-generate-config and put it in here. +{ + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + # Set your system kind (needed for flakes) + nixpkgs.hostPlatform = "x86_64-linux"; +} diff --git a/nixpkgs.nix b/nixpkgs.nix new file mode 100644 index 0000000..041de40 --- /dev/null +++ b/nixpkgs.nix @@ -0,0 +1,8 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..b2653c9 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,14 @@ +# This file defines overlays +{ + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs { pkgs = final; }; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..8c5e910 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,6 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' + +{ pkgs ? (import ../nixpkgs.nix) { } }: { + # example = pkgs.callPackage ./example { }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9525915 --- /dev/null +++ b/shell.nix @@ -0,0 +1,10 @@ +# Shell for bootstrapping flake-enabled nix and home-manager +# You can enter it through 'nix develop' or (legacy) 'nix-shell' + +{ pkgs ? (import ./nixpkgs.nix) { } }: { + default = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [ nix home-manager git ]; + }; +}