From 897fa059bcb7ecd67ec33d8e73dbd972b9460710 Mon Sep 17 00:00:00 2001 From: Stefan Ellmauthaler Date: Wed, 10 May 2023 09:59:17 +0200 Subject: [PATCH] Updates to haskell setup --- flake.nix | 128 ++++++++++++++-------------- modules/emacs/default.el | 1 - secrets/shell.nix | 29 +++---- users/ellmau/conf/xmonad/.envrc | 2 +- users/ellmau/conf/xmonad/flake.lock | 112 ------------------------ 5 files changed, 77 insertions(+), 195 deletions(-) delete mode 100644 users/ellmau/conf/xmonad/flake.lock diff --git a/flake.nix b/flake.nix index 7387047..89b06bd 100644 --- a/flake.nix +++ b/flake.nix @@ -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,58 +91,65 @@ hostDefaults = { system = "x86_64-linux"; channelName = "nixpkgs"; - 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)); + 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)); specialArgs = { nixos-hardware = inputs.nixos-hardware.nixosModules; inherit inputs; }; extraArgs = { - homeConfigurations = - withModules ./users - ( - { - name, - path, - }: - #import (./users + "/${name}") - import path - ); + homeConfigurations = withModules ./users ({ name, path, }: + #import (./users + "/${name}") + 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 { - configuration = import (./users + "/${name}"); - inherit username; - system = "x86_64-linux"; - homeDirectory = "/home/${username}"; - stateVersion = extended-lib.mkDefault "21.05"; - }); + 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"; + homeDirectory = "/home/${username}"; + stateVersion = extended-lib.mkDefault "21.05"; + }); outputsBuilder = channels: { - devShells.default = import ./secrets/shell.nix { - pkgs = channels.nixpkgs; - sops-nix = inputs.sops-nix.packages."${channels.nixpkgs.system}"; + 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"; diff --git a/modules/emacs/default.el b/modules/emacs/default.el index fa5fba9..939caed 100644 --- a/modules/emacs/default.el +++ b/modules/emacs/default.el @@ -589,7 +589,6 @@ :ensure haskell-mode) (use-package lsp-haskell :demand t) -(use-package shakespeare-mode) (use-package company-cabal :defer t :init diff --git a/secrets/shell.nix b/secrets/shell.nix index 937e073..e1c6239 100644 --- a/secrets/shell.nix +++ b/secrets/shell.nix @@ -1,19 +1,16 @@ -{ - pkgs ? import {}, - sops-nix ? pkgs.callPackage {}, - ... -}: let +{ pkgs ? import { }, sops-nix ? pkgs.callPackage { } +, 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]; - - nativeBuildInputs = [ - sops-nix.sops-import-keys-hook - sops-nix.ssh-to-pgp - sops-rekey - pkgs.wireguard-tools - ]; - } +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 + ]; +} diff --git a/users/ellmau/conf/xmonad/.envrc b/users/ellmau/conf/xmonad/.envrc index 3550a30..513f194 100644 --- a/users/ellmau/conf/xmonad/.envrc +++ b/users/ellmau/conf/xmonad/.envrc @@ -1 +1 @@ -use flake +use flake ../../../..#xmonad diff --git a/users/ellmau/conf/xmonad/flake.lock b/users/ellmau/conf/xmonad/flake.lock deleted file mode 100644 index 5bf47a4..0000000 --- a/users/ellmau/conf/xmonad/flake.lock +++ /dev/null @@ -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 -}