1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Updates to haskell setup

This commit is contained in:
Stefan Ellmauthaler 2023-05-10 09:59:17 +02:00
parent 9bdb9fe8d2
commit 897fa059bc
Failed to extract signature
5 changed files with 77 additions and 195 deletions

100
flake.nix
View File

@ -1,5 +1,6 @@
{ {
description = "Flake to define configurations of 'elss' - ellmauthaler stefan's systems"; description =
"Flake to define configurations of 'elss' - ellmauthaler stefan's systems";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
@ -11,18 +12,14 @@
# inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
#}; #};
nixos-hardware = { nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; };
url = "github:NixOS/nixos-hardware/master";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-22.11"; url = "github:nix-community/home-manager/release-22.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
flake-utils-plus = { flake-utils-plus = { url = "github:gytis-ivaskevicius/flake-utils-plus"; };
url = "github:gytis-ivaskevicius/flake-utils-plus";
};
emacs-overlay = { emacs-overlay = {
url = "github:nix-community/emacs-overlay"; url = "github:nix-community/emacs-overlay";
@ -56,22 +53,16 @@
}; };
}; };
outputs = { outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs:
self, let
nixpkgs, extended-lib = nixpkgs.lib.extend
flake-utils-plus, (final: prev: { elss = (import ./lib { lib = final; }) prev; });
... inherit (extended-lib.elss)
} @ inputs: let discoverModules moduleNames discoverMachines withModules
extended-lib = discoverTemplates;
nixpkgs.lib.extend in flake-utils-plus.lib.mkFlake rec {
(final: prev: {
elss = (import ./lib {lib = final;}) prev;
});
inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules discoverTemplates;
in
flake-utils-plus.lib.mkFlake rec {
inherit self inputs; inherit self inputs;
supportedSystems = ["x86_64-linux"]; supportedSystems = [ "x86_64-linux" ];
lib = extended-lib; lib = extended-lib;
@ -91,9 +82,7 @@
}; };
channels.nixpkgs.overlaysBuilder = channels: [ channels.nixpkgs.overlaysBuilder = channels: [
(final: prev: { (final: prev: { unstable = channels.nixpkgs-unstable; })
unstable = channels.nixpkgs-unstable;
})
(flake-utils-plus.lib.genPkgOverlay inputs.comma "comma") (flake-utils-plus.lib.genPkgOverlay inputs.comma "comma")
#inputs.nix.overlay #inputs.nix.overlay
inputs.emacs-overlay.overlay inputs.emacs-overlay.overlay
@ -102,47 +91,32 @@
hostDefaults = { hostDefaults = {
system = "x86_64-linux"; system = "x86_64-linux";
channelName = "nixpkgs"; channelName = "nixpkgs";
modules = modules = [
[
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.dwarffs.nixosModules.dwarffs inputs.dwarffs.nixosModules.dwarffs
inputs.simple-nixos-mailserver.nixosModules.mailserver inputs.simple-nixos-mailserver.nixosModules.mailserver
./common/wireguard.nix ./common/wireguard.nix
] ] ++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
specialArgs = { specialArgs = {
nixos-hardware = inputs.nixos-hardware.nixosModules; nixos-hardware = inputs.nixos-hardware.nixosModules;
inherit inputs; inherit inputs;
}; };
extraArgs = { extraArgs = {
homeConfigurations = homeConfigurations = withModules ./users ({ name, path, }:
withModules ./users
(
{
name,
path,
}:
#import (./users + "/${name}") #import (./users + "/${name}")
import path import path);
);
}; };
}; };
hosts = hosts =
discoverMachines ./machines discoverMachines ./machines { specialArgs = { lib = extended-lib; }; };
{
specialArgs = {lib = extended-lib;};
};
nixosModules = discoverModules ./modules; nixosModules = discoverModules ./modules;
homeConfigurations = homeConfigurations = withModules ./users (name:
withModules ./users let username = extended-lib.removeSuffix ".nix" name;
(name: let in inputs.home-manager.lib.homeManagerConfiguration {
username = extended-lib.removeSuffix ".nix" name;
in
inputs.home-manager.lib.homeManagerConfiguration {
configuration = import (./users + "/${name}"); configuration = import (./users + "/${name}");
inherit username; inherit username;
system = "x86_64-linux"; system = "x86_64-linux";
@ -151,9 +125,31 @@
}); });
outputsBuilder = channels: { outputsBuilder = channels: {
devShells.default = import ./secrets/shell.nix { devShells = let pkgs = channels.nixpkgs;
in rec {
sops = import ./secrets/shell.nix {
pkgs = channels.nixpkgs; pkgs = channels.nixpkgs;
sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}"; sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}";
name = "sops";
};
xmonad = pkgs.mkShell {
name = "xmonad";
nativeBuildInputs = [
# add packages here, like
# pkgs.clingo
(pkgs.ghc.withPackages (haskellPackages: [
haskellPackages.dbus
haskellPackages.monad-logger
haskellPackages.hostname
haskellPackages.xmonad
haskellPackages.xmonad-contrib
]))
pkgs.haskell-language-server
];
};
default = sops;
}; };
formatter = channels.nixpkgs.alejandra; formatter = channels.nixpkgs.alejandra;
apps = { apps = {
@ -168,12 +164,14 @@
templates = discoverTemplates ./templates { templates = discoverTemplates ./templates {
base = { base = {
description = "Basic setup of tools in nixpkgs/unstable"; description = "Basic setup of tools in nixpkgs/unstable";
welcomeText = "Change into the folder and add the wanted packages to the buildInputs"; welcomeText =
"Change into the folder and add the wanted packages to the buildInputs";
}; };
rust = { rust = {
description = "Rust development environment flake"; description = "Rust development environment flake";
welcomeText = "Change into the folder and follow the prompt to create an automatic rust environment in this folder"; welcomeText =
"Change into the folder and follow the prompt to create an automatic rust environment in this folder";
}; };
jupyter = { jupyter = {
description = "Jupyter server flake"; description = "Jupyter server flake";

View File

@ -589,7 +589,6 @@
:ensure haskell-mode) :ensure haskell-mode)
(use-package lsp-haskell (use-package lsp-haskell
:demand t) :demand t)
(use-package shakespeare-mode)
(use-package company-cabal (use-package company-cabal
:defer t :defer t
:init :init

View File

@ -1,19 +1,16 @@
{ { pkgs ? import <nixpkgs> { }, sops-nix ? pkgs.callPackage <sops-nix> { }
pkgs ? import <nixpkgs> {}, , name ? "secrets", ... }:
sops-nix ? pkgs.callPackage <sops-nix> {}, let
...
}: let
sops-rekey = pkgs.writeShellScriptBin "sops-rekey" '' sops-rekey = pkgs.writeShellScriptBin "sops-rekey" ''
${pkgs.findutils}/bin/find . -wholename '*/secrets/*.yaml' -exec ${pkgs.sops}/bin/sops updatekeys {} \; ${pkgs.findutils}/bin/find . -wholename '*/secrets/*.yaml' -exec ${pkgs.sops}/bin/sops updatekeys {} \;
''; '';
in in pkgs.mkShell {
pkgs.mkShell { sopsPGPKeyDirs = [ ./keys/users ./keys/hosts ];
sopsPGPKeyDirs = [./keys/users ./keys/hosts]; name = name;
nativeBuildInputs = [ nativeBuildInputs = [
sops-nix.sops-import-keys-hook sops-nix.sops-import-keys-hook
sops-nix.ssh-to-pgp sops-nix.ssh-to-pgp
sops-rekey sops-rekey
pkgs.wireguard-tools pkgs.wireguard-tools
]; ];
} }

View File

@ -1 +1 @@
use flake use flake ../../../..#xmonad

View File

@ -1,112 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils-plus": {
"inputs": {
"flake-utils": "flake-utils_2"
},
"locked": {
"lastModified": 1657226504,
"narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1683546353,
"narHash": "sha256-zEfx6q4fXK5wq+RCsyM0FyWBKNNhHTKMpCWkEpKDe2g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7629f9b0680d87c7775f3261bee746da5dac76d1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils-plus": "flake-utils-plus",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}