chore(nix): update flake.nix and shell.nix

This commit is contained in:
Sarah Vaupel 2023-03-31 14:31:19 +00:00
parent 28f245dfe4
commit 1a678d4b9d
3 changed files with 87 additions and 7 deletions

View File

@ -1,5 +1,21 @@
{
"nodes": {
"docker-nixpkgs": {
"flake": false,
"locked": {
"lastModified": 1678089139,
"narHash": "sha256-cK0RDcxR4eWMrdZIcqNVqnjo9k2LwVmNZO3qj1ctDXU=",
"owner": "nix-community",
"repo": "docker-nixpkgs",
"rev": "2205fb4968adf683324e6d0401b74b9d250d8f56",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "docker-nixpkgs",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1678901627,
@ -34,6 +50,7 @@
},
"root": {
"inputs": {
"docker-nixpkgs": "docker-nixpkgs",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}

View File

@ -2,14 +2,21 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{
rec {
inputs = {
# haskell-nix = {
# url = "github:input-output-hk/haskell.nix";
# };
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "master";
};
docker-nixpkgs = {
url = "github:nix-community/docker-nixpkgs";
flake = false;
};
flake-utils = {
type = "github";
owner = "numtide";
@ -18,19 +25,74 @@
};
};
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem
outputs = { self, nixpkgs, docker-nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem
(system:
let pkgs = import nixpkgs {
inherit system;
let frontendSource = pkgs.lib.sourceByRegex ./. [
"^(assets|frontend)(/.*)?$"
"^config(/(favicon\.json|robots\.txt))?$"
"^(webpack|postcss)\.config\.js$"
"^karma\.conf\.js$"
"^(package|jsconfig|\.eslintrc)\.json$"
"^\.babelrc$"
];
backendSource = pkgs.lib.sourceByRegex ./. [
"^(\.hlint|package|stack-flake)\.yaml$"
"^stack\.yaml\.lock$"
"^config(/(archive-types|mimetypes|personalised-sheet-files-collate|settings\.yml|submission-blacklist|test-settings\.yml|video-types|wordlist\.txt))?$"
"^routes$"
"^testdata(/.*)?$"
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
overlay = import ./nix/maildev;
overlays = [
(import "${docker-nixpkgs}/overlay.nix")
(import ./nix/maildev)
# haskell-nix.overlay
(import ./nix/uniworx { inherit inputs frontendSource backendSource; })
(import ./nix/docker { inherit self; })
(import ./nix/parse-changelog.nix {})
];
haskellFlake = pkgs.uniworx.flake {};
mkPushDocker = imageName: dockerImage: pkgs.writeScriptBin "push-${dockerImage.imageName}" ''
#!${pkgs.zsh}/bin/zsh -xe
target=''${1-docker://registry.gitlab.com/fradrive/fradrive/${imageName}:${dockerImage.imageTag}}
[[ -n "''${1}" ]] && shift
${pkgs.skopeo}/bin/skopeo ''${@} --insecure-policy copy docker-archive://${dockerImage} ''${target}
'';
inherit (pkgs.lib) recursiveUpdate;
in {
packages = haskellFlake.packages // {
inherit (pkgs) uniworxNodeDependencies uniworxWellKnown uniworxFrontend uniworxDemoDocker uniworxDocker ciDocker changelogJson;
};
apps = haskellFlake.apps // {
pushUniworxDemoDocker = flake-utils.lib.mkApp { drv = mkPushDocker "uniworx-demo" pkgs.uniworxDemoDocker; };
pushUniworxDocker = flake-utils.lib.mkApp { drv = mkPushDocker "uniworx" pkgs.uniworxDocker; };
pushCIDocker = flake-utils.lib.mkApp { drv = mkPushDocker "nix-unstable" pkgs.ciDocker; };
calculateMaterializedSha = flake-utils.lib.mkApp { drv = pkgs.uniworx.stack-nix.passthru.calculateMaterializedSha; execPath = ""; };
jqChangelogJson = flake-utils.lib.mkApp { drv = pkgs.jqChangelogJson; };
};
checks = haskellFlake.checks // {
uniworxFrontend = pkgs.uniworxFrontend.check;
};
devShell = import ./shell.nix { pkgs = self.legacyPackages.${system}; nixpkgsPath = nixpkgs; };
legacyPackages = recursiveUpdate (overlay self.legacyPackages.${system} pkgs) pkgs;
legacyPackages = pkgs.lib.foldr (overlay: acc: acc // recursiveUpdate (overlay self.legacyPackages.${system} pkgs) pkgs) {} overlays;
defaultPackage = self.packages.${system}."uniworx:exe:uniworx";
defaultApp = self.apps.${system}."uniworx:exe:uniworx";
}
);
}

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>
# SPDX-FileCopyrightText: 2022-2023 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@uniworx.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
@ -284,6 +284,7 @@ in pkgs.mkShell {
babel-german babel-english booktabs textpos
enumitem eurosym koma-script parskip xcolor dejavu
luatexbase lualatex-math unicode-math selnolig # required for LuaTeX
;
})
]
) ++ (with pkgs.haskellPackages; [ stack yesod-bin hlint cabal-install weeder profiteur ]);