Add tetris flake

This commit is contained in:
Charlotte Van Petegem 2022-01-11 20:56:03 +01:00
parent 773d6585f5
commit 224de7ccbc
No known key found for this signature in database
GPG key ID: 019E764B7184435A
3 changed files with 34 additions and 29 deletions

33
flake.lock generated
View file

@ -42,11 +42,11 @@
}, },
"emacs-overlay": { "emacs-overlay": {
"locked": { "locked": {
"lastModified": 1641901534, "lastModified": 1641926379,
"narHash": "sha256-Nvm6Zj80fVtzmGsUFYlz9XGFyLnyAe9VoduPmDBu+js=", "narHash": "sha256-zvp7ATyqNv9952TwxPcRg3t8BI2HEIrnPdZHRaUOoU0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "57378ea2f62e9f450f420dc9d01cc06e0d3dd15e", "rev": "c41bd1462ade47da23e5df9a82badb19c9185bb0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -113,10 +113,31 @@
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"tetris": "tetris",
"utils": "utils", "utils": "utils",
"zeroad": "zeroad" "zeroad": "zeroad"
} }
}, },
"tetris": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1641928399,
"narHash": "sha256-55FwNVfgHReLbaktBx31rtPJFkp+HenD8uLTzV2+GEA=",
"owner": "chvp",
"repo": "tetris",
"rev": "dd70718cac370d2bc44c1b45848969386282970b",
"type": "github"
},
"original": {
"owner": "chvp",
"repo": "tetris",
"type": "github"
}
},
"utils": { "utils": {
"inputs": { "inputs": {
"flake-utils": "flake-utils" "flake-utils": "flake-utils"
@ -142,11 +163,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1641824052, "lastModified": 1641927600,
"narHash": "sha256-xbPD2kYtLAIekf701s6hMo9ArA/8X91CiP9zXqK3me8=", "narHash": "sha256-1zZyiAODX6fwGNylT4/hP/2OphIOctAevl9VPTtbssg=",
"owner": "chvp", "owner": "chvp",
"repo": "0ad-flake", "repo": "0ad-flake",
"rev": "73d0ba0dc3d22e8d67139cc3697afaebca1c6cd9", "rev": "1b93201ef3c24479c3ecd598bb05ad8a3f0faf67",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -16,6 +16,10 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
tetris = {
url = "github:chvp/tetris";
inputs.nixpkgs.follows = "nixpkgs";
};
utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
zeroad = { zeroad = {
url = "github:chvp/0ad-flake"; url = "github:chvp/0ad-flake";
@ -23,7 +27,7 @@
}; };
}; };
outputs = inputs@{ self, nixpkgs, accentor, agenix, emacs-overlay, home-manager, zeroad, utils }: outputs = inputs@{ self, nixpkgs, accentor, agenix, emacs-overlay, home-manager, zeroad, tetris, utils }:
let let
customPackages = callPackage: { customPackages = callPackage: {
jdtls = callPackage ./packages/jdtls { }; jdtls = callPackage ./packages/jdtls { };
@ -38,6 +42,7 @@
emacs-overlay.overlay emacs-overlay.overlay
(self: super: customPackages self.callPackage) (self: super: customPackages self.callPackage)
(self: super: { zeroad = zeroad.packages.x86_64-linux.zeroad; }) (self: super: { zeroad = zeroad.packages.x86_64-linux.zeroad; })
(self: super: { tetris = tetris.packages.x86_64-linux.tetris; })
]; ];
}; };
hostDefaults = { hostDefaults = {

View file

@ -1,26 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let
tetris = pkgs.mkYarnPackage rec {
pname = "tetris";
version = "unstable";
src = pkgs.fetchFromGitHub {
owner = "chvp";
repo = "tetris";
rev = "main";
sha256 = "lH7LV03pRCJnY4ZjklWpmNuWjrQUiy1LwuByQlA1nTg=";
};
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
buildPhase = "yarn run build";
installPhase = ''
cp -r deps/tetris/dist $out
rm $out/*.map
'';
distPhase = "true";
};
in
{ {
options.chvp.games.tetris.server = lib.mkOption { options.chvp.games.tetris.server = lib.mkOption {
default = false; default = false;
@ -31,7 +10,7 @@ in
chvp.services.nginx.hosts = [{ chvp.services.nginx.hosts = [{
fqdn = "tetris.vanpetegem.me"; fqdn = "tetris.vanpetegem.me";
options = { options = {
root = "${tetris}"; root = "${pkgs.tetris}";
locations."/".index = "index.html"; locations."/".index = "index.html";
}; };
}]; }];