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 = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
@ -11,18 +12,14 @@
# inputs.nixpkgs.follows = "nixpkgs";
#};
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; };
home-manager = {
url = "github:nix-community/home-manager/release-22.11";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils-plus = {
url = "github:gytis-ivaskevicius/flake-utils-plus";
};
flake-utils-plus = { url = "github:gytis-ivaskevicius/flake-utils-plus"; };
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
@ -56,22 +53,16 @@
};
};
outputs = {
self,
nixpkgs,
flake-utils-plus,
...
} @ inputs: let
extended-lib =
nixpkgs.lib.extend
(final: prev: {
elss = (import ./lib {lib = final;}) prev;
});
inherit (extended-lib.elss) discoverModules moduleNames discoverMachines withModules discoverTemplates;
in
flake-utils-plus.lib.mkFlake rec {
outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs:
let
extended-lib = nixpkgs.lib.extend
(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;
supportedSystems = ["x86_64-linux"];
supportedSystems = [ "x86_64-linux" ];
lib = extended-lib;
@ -91,9 +82,7 @@
};
channels.nixpkgs.overlaysBuilder = channels: [
(final: prev: {
unstable = channels.nixpkgs-unstable;
})
(final: prev: { unstable = channels.nixpkgs-unstable; })
(flake-utils-plus.lib.genPkgOverlay inputs.comma "comma")
#inputs.nix.overlay
inputs.emacs-overlay.overlay
@ -102,47 +91,32 @@
hostDefaults = {
system = "x86_64-linux";
channelName = "nixpkgs";
modules =
[
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops
inputs.dwarffs.nixosModules.dwarffs
inputs.simple-nixos-mailserver.nixosModules.mailserver
./common/wireguard.nix
]
++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
] ++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
specialArgs = {
nixos-hardware = inputs.nixos-hardware.nixosModules;
inherit inputs;
};
extraArgs = {
homeConfigurations =
withModules ./users
(
{
name,
path,
}:
homeConfigurations = withModules ./users ({ name, path, }:
#import (./users + "/${name}")
import path
);
import path);
};
};
hosts =
discoverMachines ./machines
{
specialArgs = {lib = extended-lib;};
};
discoverMachines ./machines { specialArgs = { lib = extended-lib; }; };
nixosModules = discoverModules ./modules;
homeConfigurations =
withModules ./users
(name: let
username = extended-lib.removeSuffix ".nix" name;
in
inputs.home-manager.lib.homeManagerConfiguration {
homeConfigurations = withModules ./users (name:
let username = extended-lib.removeSuffix ".nix" name;
in inputs.home-manager.lib.homeManagerConfiguration {
configuration = import (./users + "/${name}");
inherit username;
system = "x86_64-linux";
@ -151,9 +125,31 @@
});
outputsBuilder = channels: {
devShells.default = import ./secrets/shell.nix {
devShells = let pkgs = channels.nixpkgs;
in rec {
sops = import ./secrets/shell.nix {
pkgs = channels.nixpkgs;
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;
apps = {
@ -168,12 +164,14 @@
templates = discoverTemplates ./templates {
base = {
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 = {
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 = {
description = "Jupyter server flake";

View File

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

View File

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