chore(gitlab-ci): ...
This commit is contained in:
parent
17ccec3d1a
commit
bad9afc1b8
@ -6,7 +6,7 @@ workflow:
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
image:
|
image:
|
||||||
name: nixpkgs/nix-flakes:nixos-21.05
|
name: registry.gitlab.com/fradrive/fradrive/nix-unstable
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"
|
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"
|
||||||
@ -26,7 +26,6 @@ node dependencies:
|
|||||||
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
|
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
|
||||||
- .gitlab-ci/write-minio-creds.sh
|
- .gitlab-ci/write-minio-creds.sh
|
||||||
- .gitlab-ci/make-minio-bucket.sh
|
- .gitlab-ci/make-minio-bucket.sh
|
||||||
- "nix-env -f .gitlab-ci/patched-nix.nix -iE 'f: f {}'"
|
|
||||||
- cp -pr --reflink=auto -L .gitlab-ci/upload-to-cache.sh /etc/nix/upload-to-cache.sh
|
- cp -pr --reflink=auto -L .gitlab-ci/upload-to-cache.sh /etc/nix/upload-to-cache.sh
|
||||||
- install -m 0644 .gitlab-ci/nix.conf /etc/nix/nix.conf
|
- install -m 0644 .gitlab-ci/nix.conf /etc/nix/nix.conf
|
||||||
- git config --global init.defaultBranch master
|
- git config --global init.defaultBranch master
|
||||||
|
|||||||
17
flake.lock
17
flake.lock
@ -151,6 +151,22 @@
|
|||||||
"url": "ssh://git@gitlab2.rz.ifi.lmu.de/uni2work/cryptonite.git"
|
"url": "ssh://git@gitlab2.rz.ifi.lmu.de/uni2work/cryptonite.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"docker-nixpkgs": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1631525111,
|
||||||
|
"narHash": "sha256-dJKw280B1Hp0f6tSkBtkY0nrMT0DR/bmerrS3cQdBjI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "docker-nixpkgs",
|
||||||
|
"rev": "df7f64139a0b2384fb2448dc2a406815f8d03867",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "docker-nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"encoding": {
|
"encoding": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -465,6 +481,7 @@
|
|||||||
"conduit-resumablesink": "conduit-resumablesink",
|
"conduit-resumablesink": "conduit-resumablesink",
|
||||||
"cryptoids": "cryptoids",
|
"cryptoids": "cryptoids",
|
||||||
"cryptonite": "cryptonite",
|
"cryptonite": "cryptonite",
|
||||||
|
"docker-nixpkgs": "docker-nixpkgs",
|
||||||
"encoding": "encoding",
|
"encoding": "encoding",
|
||||||
"esqueleto": "esqueleto",
|
"esqueleto": "esqueleto",
|
||||||
"flake-utils": [
|
"flake-utils": [
|
||||||
|
|||||||
23
flake.nix
23
flake.nix
@ -3,6 +3,11 @@
|
|||||||
inputs.nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
inputs.nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
|
||||||
inputs.flake-utils.follows = "haskell-nix/flake-utils";
|
inputs.flake-utils.follows = "haskell-nix/flake-utils";
|
||||||
|
|
||||||
|
inputs.docker-nixpkgs = {
|
||||||
|
url = "github:nix-community/docker-nixpkgs";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
inputs.encoding = {
|
inputs.encoding = {
|
||||||
url = "git+ssh://git@gitlab2.rz.ifi.lmu.de/uni2work/encoding.git?ref=uni2work";
|
url = "git+ssh://git@gitlab2.rz.ifi.lmu.de/uni2work/encoding.git?ref=uni2work";
|
||||||
flake = false;
|
flake = false;
|
||||||
@ -69,7 +74,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, flake-utils, haskell-nix, ... }: flake-utils.lib.eachSystem ["x86_64-linux"]
|
outputs = inputs@{ self, nixpkgs, flake-utils, haskell-nix, docker-nixpkgs, ... }: flake-utils.lib.eachSystem ["x86_64-linux"]
|
||||||
(system:
|
(system:
|
||||||
let frontendSource = pkgs.lib.sourceByRegex ./. [
|
let frontendSource = pkgs.lib.sourceByRegex ./. [
|
||||||
"^(assets|frontend)(/.*)?$"
|
"^(assets|frontend)(/.*)?$"
|
||||||
@ -92,6 +97,11 @@
|
|||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
overlays = [
|
overlays = [
|
||||||
|
# remove once https://github.com/NixOS/nix/pull/5266 has landed in https://hub.docker.com/r/nixpkgs/nix-unstable
|
||||||
|
(import ./nix/aws-patch.nix)
|
||||||
|
(import "${docker-nixpkgs}/overlay.nix")
|
||||||
|
# end remove
|
||||||
|
|
||||||
(import ./nix/maildev)
|
(import ./nix/maildev)
|
||||||
haskell-nix.overlay
|
haskell-nix.overlay
|
||||||
(import ./nix/uniworx { inherit inputs frontendSource backendSource; })
|
(import ./nix/uniworx { inherit inputs frontendSource backendSource; })
|
||||||
@ -99,10 +109,10 @@
|
|||||||
];
|
];
|
||||||
haskellFlake = pkgs.uniworx.flake {};
|
haskellFlake = pkgs.uniworx.flake {};
|
||||||
|
|
||||||
mkPushUniworxDocker = dockerImage: pkgs.writeScriptBin "push-${dockerImage.name}" ''
|
mkPushDocker = imageName: dockerImage: pkgs.writeScriptBin "push-${dockerImage.imageName}" ''
|
||||||
#!${pkgs.zsh}/bin/zsh -xe
|
#!${pkgs.zsh}/bin/zsh -xe
|
||||||
|
|
||||||
target=''${1-docker://registry.gitlab.com/fradrive/fradrive/${dockerImage.name}:${dockerImage.imageTag}}
|
target=''${1-docker://registry.gitlab.com/fradrive/fradrive/${imageName}:${dockerImage.imageTag}}
|
||||||
[[ -n "''${1}" ]] && shift
|
[[ -n "''${1}" ]] && shift
|
||||||
${pkgs.skopeo}/bin/skopeo ''${@} --insecure-policy copy docker-archive://${dockerImage} ''${target}
|
${pkgs.skopeo}/bin/skopeo ''${@} --insecure-policy copy docker-archive://${dockerImage} ''${target}
|
||||||
'';
|
'';
|
||||||
@ -117,12 +127,13 @@
|
|||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages = haskellFlake.packages // {
|
packages = haskellFlake.packages // {
|
||||||
inherit (pkgs) uniworxNodeDependencies uniworxWellKnown uniworxFrontend uniworxDemoDocker uniworxDocker;
|
inherit (pkgs) uniworxNodeDependencies uniworxWellKnown uniworxFrontend uniworxDemoDocker uniworxDocker ciDocker;
|
||||||
inherit uniworxBackend;
|
inherit uniworxBackend;
|
||||||
};
|
};
|
||||||
apps = haskellFlake.apps // {
|
apps = haskellFlake.apps // {
|
||||||
pushUniworxDemoDocker = flake-utils.lib.mkApp { drv = mkPushUniworxDocker pkgs.uniworxDemoDocker; };
|
pushUniworxDemoDocker = flake-utils.lib.mkApp { drv = mkPushDocker "uniworx-demo" pkgs.uniworxDemoDocker; };
|
||||||
pushUniworxDocker = flake-utils.lib.mkApp { drv = mkPushUniworxDocker pkgs.uniworxDocker; };
|
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; exePath = ""; };
|
calculateMaterializedSha = flake-utils.lib.mkApp { drv = pkgs.uniworx.stack-nix.passthru.calculateMaterializedSha; exePath = ""; };
|
||||||
};
|
};
|
||||||
checks = haskellFlake.checks // {
|
checks = haskellFlake.checks // {
|
||||||
|
|||||||
11
nix/aws-patch.nix
Normal file
11
nix/aws-patch.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
final: prev:
|
||||||
|
let
|
||||||
|
awsPatch = prev.fetchurl {
|
||||||
|
url = "https://github.com/gkleen/nix/commit/fd67a0f927ec0711eba59714939ff939fc95db38.diff";
|
||||||
|
hash = "sha256-1dJ9zGQvYu5b47O2NjdggSSinlGQDcqBwXoZcKUGfYQ=";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
nixUnstable = prev.nixUnstable.overrideAttrs (oldAttrs: {
|
||||||
|
patches = oldAttrs.patches or [] ++ [ awsPatch ];
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -3,18 +3,20 @@
|
|||||||
with prev.lib;
|
with prev.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
created =
|
||||||
|
let
|
||||||
|
fromDate = builtins.readFile (prev.runCommand "date" { nativeBuildInputs = with final; [ coreutils ]; } ''
|
||||||
|
printf '%s' $(date -Is -d '@${toString self.lastModified}') > $out
|
||||||
|
'');
|
||||||
|
in if self ? lastModified then fromDate else "1970-01-01T00:00:01Z";
|
||||||
|
|
||||||
mkUniworxDocker = { isDemo }: prev.dockerTools.buildImage {
|
mkUniworxDocker = { isDemo }: prev.dockerTools.buildImage {
|
||||||
name = "uniworx${optionalString isDemo "-demo"}";
|
name = "uniworx${optionalString isDemo "-demo"}";
|
||||||
tag =
|
tag =
|
||||||
let
|
let
|
||||||
versionFile = if isDemo then ./demo-version.json else ./version.json;
|
versionFile = if isDemo then ./demo-version.json else ./version.json;
|
||||||
in (builtins.fromJSON (prev.lib.readFile versionFile)).version;
|
in (builtins.fromJSON (prev.lib.readFile versionFile)).version;
|
||||||
created =
|
inherit created;
|
||||||
let
|
|
||||||
fromDate = builtins.readFile (prev.runCommand "date" { nativeBuildInputs = with final; [ coreutils ]; } ''
|
|
||||||
printf '%s' $(date -Is -d '@${toString self.lastModified}') > $out
|
|
||||||
'');
|
|
||||||
in if self ? lastModified then fromDate else "1970-01-01T00:00:01Z";
|
|
||||||
|
|
||||||
contents = with final; [
|
contents = with final; [
|
||||||
uniworx.uniworx.components.exes.uniworx
|
uniworx.uniworx.components.exes.uniworx
|
||||||
@ -121,7 +123,15 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in mapAttrs (_name: mkUniworxDocker) {
|
in
|
||||||
|
{
|
||||||
|
ciDocker = prev.docker-nixpkgs.nix-flakes.overrideAttrs (oldAttrs: {
|
||||||
|
inherit created;
|
||||||
|
contents = oldAttrs.contents or [] ++ [
|
||||||
|
final.bash final.coreutils final.minio-client
|
||||||
|
];
|
||||||
|
});
|
||||||
|
} // mapAttrs (_name: mkUniworxDocker) {
|
||||||
uniworxDemoDocker = { isDemo = true; };
|
uniworxDemoDocker = { isDemo = true; };
|
||||||
uniworxDocker = { isDemo = false; };
|
uniworxDocker = { isDemo = false; };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user